﻿namespace ACCOUNTING
{
    using ACCOUNTING.LVY.Business;
    using ACCOUNTING.My.Resources;
    using C1.Win.C1FlexGrid;
    using C1.Win.C1FlexGrid.Util.BaseControls;
    using Microsoft.VisualBasic;
    using Microsoft.VisualBasic.CompilerServices;
    using System;
    using System.Collections;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Data.OleDb;
    using System.Diagnostics;
    using System.Drawing;
    using System.Runtime.CompilerServices;
    using System.Windows.Forms;

    [DesignerGenerated]
    public class Frm_HienThiDuLieu : Form
    {
        private static List<WeakReference> __ENCList = new List<WeakReference>();
        [AccessedThroughProperty("cmdNhap")]
        private Button _cmdNhap;
        [AccessedThroughProperty("CmdThoat")]
        private Button _CmdThoat;
        [AccessedThroughProperty("Label1")]
        private Label _Label1;
        [AccessedThroughProperty("Label2")]
        private Label _Label2;
        [AccessedThroughProperty("lblTitle")]
        private Label _lblTitle;
        [AccessedThroughProperty("Panel1")]
        private Panel _Panel1;
        [AccessedThroughProperty("Panel2")]
        private Panel _Panel2;
        [AccessedThroughProperty("Panel3")]
        private Panel _Panel3;
        [AccessedThroughProperty("Panel4")]
        private Panel _Panel4;
        [AccessedThroughProperty("Panel5")]
        private Panel _Panel5;
        [AccessedThroughProperty("Panel6")]
        private Panel _Panel6;
        [AccessedThroughProperty("Panel7")]
        private Panel _Panel7;
        [AccessedThroughProperty("VSlist")]
        private C1.Win.C1FlexGrid.C1FlexGrid _VSlist;
        private IContainer components;
        private DataTable pData;
        public string strFileName;
        public string strLoai;

        public Frm_HienThiDuLieu()
        {
            base.Load += new EventHandler(this.Frm_HienThiDuLieu_Load);
            List<WeakReference> list = __ENCList;
            lock (list)
            {
                __ENCList.Add(new WeakReference(this));
            }
            this.strFileName = "";
            this.strLoai = "";
            this.pData = null;
            this.InitializeComponent();
        }

        private void cmdNhap_Click(object sender, EventArgs e)
        {
            int num = 0;
            switch (this.strLoai)
            {
                case "E001":
                    num = this.SaveDanhMucDonViTinh();
                    if (num > 0)
                    {
                        LVYModule.ShowWarning("Đ\x00e3 nhập th\x00e0nh c\x00f4ng " + Conversions.ToString(num) + " đơn vị t\x00ednh v\x00e0o danh mục!");
                    }
                    else
                    {
                        LVYModule.ShowWarning("Kh\x00f4ng c\x00f3 đơn vị t\x00ednh n\x00e0o được nhập !");
                    }
                    break;

                case "E002":
                    num = this.SaveDanhMucHangSanXuat();
                    if (num > 0)
                    {
                        LVYModule.ShowWarning("Đ\x00e3 nhập th\x00e0nh c\x00f4ng " + Conversions.ToString(num) + " h\x00e3ng sản xuất v\x00e0o danh mục!");
                    }
                    else
                    {
                        LVYModule.ShowWarning("Kh\x00f4ng c\x00f3 h\x00e3ng sản xuất n\x00e0o được nhập !");
                    }
                    break;

                case "E003":
                    num = this.SaveDanhMucLoaiKhachHang();
                    if (num > 0)
                    {
                        LVYModule.ShowWarning("Đ\x00e3 nhập th\x00e0nh c\x00f4ng " + Conversions.ToString(num) + " loại kh\x00e1ch h\x00e0ng v\x00e0o danh mục!");
                    }
                    else
                    {
                        LVYModule.ShowWarning("Kh\x00f4ng c\x00f3 loại kh\x00e1ch h\x00e0ng n\x00e0o được nhập !");
                    }
                    break;

                case "E004":
                    num = this.SaveDanhMucNganhHang();
                    if (num > 0)
                    {
                        LVYModule.ShowWarning("Đ\x00e3 nhập th\x00e0nh c\x00f4ng " + Conversions.ToString(num) + " ng\x00e0nh h\x00e0ng v\x00e0o danh mục!");
                    }
                    else
                    {
                        LVYModule.ShowWarning("Kh\x00f4ng c\x00f3 ng\x00e0nh h\x00e0ng n\x00e0o được nhập !");
                    }
                    break;

                case "E005":
                    num = this.SaveDanhMucNganhKinhDoanh();
                    if (num > 0)
                    {
                        LVYModule.ShowWarning("Đ\x00e3 nhập th\x00e0nh c\x00f4ng " + Conversions.ToString(num) + " ng\x00e0nh kinh doanh v\x00e0o danh mục!");
                    }
                    else
                    {
                        LVYModule.ShowWarning("Kh\x00f4ng c\x00f3 ng\x00e0nh kinh doanh n\x00e0o được nhập !");
                    }
                    break;

                case "E006":
                    num = this.SaveDanhMucQuocGia();
                    if (num > 0)
                    {
                        LVYModule.ShowWarning("Đ\x00e3 nhập th\x00e0nh c\x00f4ng " + Conversions.ToString(num) + " quốc gia v\x00e0o danh mục!");
                    }
                    else
                    {
                        LVYModule.ShowWarning("Kh\x00f4ng c\x00f3 quốc gia n\x00e0o được nhập !");
                    }
                    break;

                case "E007":
                    num = this.SaveDanhMucNhomHangHoa();
                    if (num > 0)
                    {
                        LVYModule.ShowWarning("Đ\x00e3 nhập th\x00e0nh c\x00f4ng " + Conversions.ToString(num) + " nh\x00f3m h\x00e0ng h\x00f3a v\x00e0o danh mục!");
                    }
                    else
                    {
                        LVYModule.ShowWarning("Kh\x00f4ng c\x00f3 nh\x00f3m h\x00e0ng h\x00f3a n\x00e0o được nhập !");
                    }
                    break;

                case "E008":
                    num = this.SaveDanhMucKhachHang();
                    if (num > 0)
                    {
                        LVYModule.ShowWarning("Đ\x00e3 nhập th\x00e0nh c\x00f4ng " + Conversions.ToString(num) + " kh\x00e1ch h\x00e0ng v\x00e0o danh mục!");
                    }
                    else
                    {
                        LVYModule.ShowWarning("Kh\x00f4ng c\x00f3 kh\x00e1ch h\x00e0ng n\x00e0o được nhập !");
                    }
                    break;

                case "E009":
                    num = this.SaveDanhMucNhaCungCap();
                    if (num > 0)
                    {
                        LVYModule.ShowWarning("Đ\x00e3 nhập th\x00e0nh c\x00f4ng " + Conversions.ToString(num) + " nh\x00e0 cung cấp v\x00e0o danh mục!");
                    }
                    else
                    {
                        LVYModule.ShowWarning("Kh\x00f4ng c\x00f3 nh\x00e0 cung cấp n\x00e0o được nhập !");
                    }
                    break;

                case "E010":
                    num = this.SaveDanhMucHangHoa();
                    if (num > 0)
                    {
                        LVYModule.ShowWarning("Đ\x00e3 nhập th\x00e0nh c\x00f4ng " + Conversions.ToString(num) + " mặt h\x00e0ng v\x00e0o danh mục!");
                    }
                    else
                    {
                        LVYModule.ShowWarning("Kh\x00f4ng c\x00f3 mặt h\x00e0ng n\x00e0o được nhập !");
                    }
                    break;

                case "E011":
                    num = this.SaveDanhMucKho();
                    if (num > 0)
                    {
                        LVYModule.ShowWarning("Đ\x00e3 nhập th\x00e0nh c\x00f4ng " + Conversions.ToString(num) + " kho h\x00e0ng v\x00e0o danh mục!");
                    }
                    else
                    {
                        LVYModule.ShowWarning("Kh\x00f4ng c\x00f3 kho h\x00e0ng n\x00e0o được nhập !");
                    }
                    break;
            }
        }

        private void CmdThoat_Click(object sender, EventArgs e)
        {
            this.Dispose();
        }

        [DebuggerNonUserCode]
        protected override void Dispose(bool disposing)
        {
            try
            {
                if (disposing && (this.components != null))
                {
                    this.components.Dispose();
                }
            }
            finally
            {
                base.Dispose(disposing);
            }
        }

        private void Frm_HienThiDuLieu_Load(object sender, EventArgs e)
        {
            if (!Microsoft.VisualBasic.CompilerServices.Operators.ConditionalCompareObjectEqual(LVYModule.ReturnIfNull(this.strFileName, "", modGeneral.TypeOfValue.Nothing), "", false))
            {
                try
                {
                    this.pData = this.ImportExcelXLS(this.strFileName, true).Tables[0];
                }
                catch (Exception exception1)
                {
                    ProjectData.SetProjectError(exception1);
                    Exception exception = exception1;
                    LVYModule.ShowWarning("File Excel kh\x00f4ng ph\x00f9 hợp với loại dữ liệu nhập hoặc kh\x00f4ng c\x00f3 dữ liệu !");
                    this.Dispose();
                    ProjectData.ClearProjectError();
                    return;
                }
                if (this.pData.Rows.Count <= 0)
                {
                    LVYModule.ShowWarning("File Excel kh\x00f4ng c\x00f3 dữ liệu !");
                    this.Dispose();
                }
                else
                {
                    switch (this.strLoai)
                    {
                        case "E001":
                            this.lblTitle.Text = "DANH MỤC ĐƠN VỊ T\x00cdNH";
                            this.LoadDanhMucDonViTinh(this.pData);
                            break;

                        case "E002":
                            this.lblTitle.Text = "DANH MỤC H\x00c3NG SẢN XUẤT";
                            this.LoadDanhMucHangSanXuat(this.pData);
                            break;

                        case "E003":
                            this.lblTitle.Text = "DANH MỤC LOẠI K.H\x00c0NG";
                            this.LoadDanhMucLoaiKhachHang(this.pData);
                            break;

                        case "E004":
                            this.lblTitle.Text = "DANH MỤC NG\x00c0NH H\x00c0NG";
                            this.LoadDanhMucNganhHang(this.pData);
                            break;

                        case "E005":
                            this.lblTitle.Text = "DANH MỤC NG\x00c0NH K.DOANH";
                            this.LoadDanhMucNganhKinhDoanh(this.pData);
                            break;

                        case "E006":
                            this.lblTitle.Text = "DANH MỤC QUỐC GIA";
                            this.LoadDanhMucQuocGia(this.pData);
                            break;

                        case "E007":
                            this.lblTitle.Text = "DANH MỤC NH\x00d3M H.H\x00d3A";
                            this.LoadDanhMucNhomHangHoa(this.pData);
                            break;

                        case "E008":
                            this.lblTitle.Text = "DANH MỤC KH\x00c1CH H\x00c0NG";
                            this.LoadDanhMucKhachHang(this.pData);
                            break;

                        case "E009":
                            this.lblTitle.Text = "DANH MỤC NH\x00c0 CUNG CẤP";
                            this.LoadDanhMucNhaCungCap(this.pData);
                            break;

                        case "E010":
                            this.lblTitle.Text = "DANH MỤC H\x00c0NG H\x00d3A";
                            this.LoadDanhMucHangHoa(this.pData);
                            break;

                        case "E011":
                            this.lblTitle.Text = "DANH MỤC KHO H\x00c0NG";
                            this.LoadDanhMucKho(this.pData);
                            break;
                    }
                }
            }
        }

        public DataSet ImportExcelXLS(string strFileName, bool hasHeaders)
        {
             IEnumerator enumerator=null;
            string str = "";
            if (hasHeaders)
            {
                str = "Yes";
            }
            else
            {
                str = "No";
            }
            string connectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + strFileName + ";Extended Properties=\"Excel 8.0;HDR=" + str + ";IMEX=1\"";
            DataSet set2 = new DataSet();
            OleDbConnection connection = new OleDbConnection();
            connection = new OleDbConnection(connectionString);
            connection.Open();
            DataTable oleDbSchemaTable = null;
            oleDbSchemaTable = connection.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, new object[] { null, null, null, "TABLE" });
            try
            {
                enumerator = oleDbSchemaTable.Rows.GetEnumerator();
                while (enumerator.MoveNext())
                {
                    DataRow current = (DataRow) enumerator.Current;
                    string sheet = current["TABLE_NAME"].ToString();
                    if (!Conversions.ToBoolean(Microsoft.VisualBasic.CompilerServices.Operators.NotObject(this.KtraFileExcel(sheet))))
                    {
                        OleDbCommand selectCommand = new OleDbCommand("SELECT * FROM [" + sheet + "]", connection) {
                            CommandType = CommandType.Text
                        };
                        DataTable dataTable = new DataTable();
                        new OleDbDataAdapter(selectCommand).Fill(dataTable);
                        set2.Tables.Add(dataTable);
                    }
                    return set2;
                }
            }
            finally
            {
                if (enumerator is IDisposable)
                {
                    (enumerator as IDisposable).Dispose();
                }
            }
            return set2;
        }

        [DebuggerStepThrough]
        private void InitializeComponent()
        {
            ComponentResourceManager manager = new ComponentResourceManager(typeof(Frm_HienThiDuLieu));
            this.Panel1 = new Panel();
            this.Panel7 = new Panel();
            this.Label1 = new Label();
            this.Panel4 = new Panel();
            this.Label2 = new Label();
            this.Panel5 = new Panel();
            this.lblTitle = new Label();
            this.Panel2 = new Panel();
            this.VSlist = new C1.Win.C1FlexGrid.C1FlexGrid();
            this.Panel3 = new Panel();
            this.Panel6 = new Panel();
            this.CmdThoat = new Button();
            this.cmdNhap = new Button();
            this.Panel1.SuspendLayout();
            this.Panel7.SuspendLayout();
            this.Panel2.SuspendLayout();
            this.VSlist.BeginInit();
            this.Panel3.SuspendLayout();
            this.Panel6.SuspendLayout();
            this.SuspendLayout();
            this.Panel1.BackgroundImage = ACCOUNTING.My.Resources.Resources.bgleft;
            this.Panel1.Controls.Add(this.Panel7);
            this.Panel1.Controls.Add(this.lblTitle);
            this.Panel1.Dock = DockStyle.Top;
            Point point = new Point(0, 0);
            this.Panel1.Location = point;
            this.Panel1.Name = "Panel1";
            Size size = new Size(0x351, 0x30);
            this.Panel1.Size = size;
            this.Panel1.TabIndex = 2;
            this.Panel7.BackColor = Color.Transparent;
            this.Panel7.Controls.Add(this.Label1);
            this.Panel7.Controls.Add(this.Panel4);
            this.Panel7.Controls.Add(this.Label2);
            this.Panel7.Controls.Add(this.Panel5);
            this.Panel7.Dock = DockStyle.Right;
            point = new Point(0x1f6, 0);
            this.Panel7.Location = point;
            this.Panel7.Name = "Panel7";
            size = new Size(0x15b, 0x30);
            this.Panel7.Size = size;
            this.Panel7.TabIndex = 5;
            this.Label1.AutoSize = true;
            this.Label1.BackColor = Color.Transparent;
            point = new Point(0x47, 6);
            this.Label1.Location = point;
            this.Label1.Name = "Label1";
            size = new Size(0xa4, 13);
            this.Label1.Size = size;
            this.Label1.TabIndex = 2;
            this.Label1.Text = "D\x00f2ng dữ liệu đ\x00e3 c\x00f3 M\x00e3 đ\x00e3 tồn tại";
            this.Panel4.BackColor = Color.Goldenrod;
            point = new Point(4, 3);
            this.Panel4.Location = point;
            this.Panel4.Name = "Panel4";
            size = new Size(0x3d, 0x13);
            this.Panel4.Size = size;
            this.Panel4.TabIndex = 0;
            this.Label2.AutoSize = true;
            this.Label2.BackColor = Color.Transparent;
            point = new Point(0x47, 0x1c);
            this.Label2.Location = point;
            this.Label2.Name = "Label2";
            size = new Size(0x111, 13);
            this.Label2.Size = size;
            this.Label2.TabIndex = 3;
            this.Label2.Text = "V\x00f9ng dữ liệu kh\x00f4ng được rỗng hoặc dữ liệu kh\x00f4ng đ\x00fang";
            this.Panel5.BackColor = Color.Blue;
            point = new Point(4, 0x19);
            this.Panel5.Location = point;
            this.Panel5.Name = "Panel5";
            size = new Size(0x3d, 0x13);
            this.Panel5.Size = size;
            this.Panel5.TabIndex = 1;
            this.lblTitle.AutoSize = true;
            this.lblTitle.BackColor = Color.Transparent;
            this.lblTitle.Font = new Font("Tahoma", 15f, FontStyle.Bold, GraphicsUnit.Point, 0);
            point = new Point(3, 9);
            this.lblTitle.Location = point;
            this.lblTitle.Name = "lblTitle";
            size = new Size(0x43, 0x18);
            this.lblTitle.Size = size;
            this.lblTitle.TabIndex = 4;
            this.lblTitle.Text = "TITLE";
            this.Panel2.BackgroundImage = ACCOUNTING.My.Resources.Resources.background;
            this.Panel2.Controls.Add(this.VSlist);
            this.Panel2.Dock = DockStyle.Fill;
            point = new Point(0, 0x30);
            this.Panel2.Location = point;
            this.Panel2.Name = "Panel2";
            size = new Size(0x351, 0x157);
            this.Panel2.Size = size;
            this.Panel2.TabIndex = 3;
            this.VSlist.AllowEditing = false;
            this.VSlist.BorderStyle = C1.Win.C1FlexGrid.Util.BaseControls.BorderStyleEnum.Light3D;
            this.VSlist.ColumnInfo = "37,0,0,0,0,90,Columns:36{Caption:\"ID\";Visible:False;}\t";
            this.VSlist.Dock = DockStyle.Fill;
            this.VSlist.ExtendLastCol = true;
            this.VSlist.KeyActionEnter = KeyActionEnum.MoveAcross;
            point = new Point(0, 0);
            this.VSlist.Location = point;
            this.VSlist.Name = "VSlist";
            this.VSlist.Rows.Count = 1;
            this.VSlist.Rows.DefaultSize = 0x11;
            this.VSlist.Rows.MinSize = 20;
            size = new Size(0x351, 0x157);
            this.VSlist.Size = size;
            this.VSlist.StyleInfo = manager.GetString("VSlist.StyleInfo");
            this.VSlist.TabIndex = 0x20;
            this.VSlist.Tag = "NV-0013";
            this.VSlist.VisualStyle = VisualStyle.Office2007Blue;
            this.Panel3.BackgroundImage = ACCOUNTING.My.Resources.Resources.bgleft;
            this.Panel3.Controls.Add(this.Panel6);
            this.Panel3.Controls.Add(this.cmdNhap);
            this.Panel3.Dock = DockStyle.Bottom;
            point = new Point(0, 0x187);
            this.Panel3.Location = point;
            this.Panel3.Name = "Panel3";
            size = new Size(0x351, 40);
            this.Panel3.Size = size;
            this.Panel3.TabIndex = 4;
            this.Panel6.BackColor = Color.Transparent;
            this.Panel6.Controls.Add(this.CmdThoat);
            this.Panel6.Dock = DockStyle.Right;
            point = new Point(0x2dd, 0);
            this.Panel6.Location = point;
            this.Panel6.Name = "Panel6";
            size = new Size(0x74, 40);
            this.Panel6.Size = size;
            this.Panel6.TabIndex = 3;
            this.CmdThoat.Image = ACCOUNTING.My.Resources.Resources.Closed;
            this.CmdThoat.ImageAlign = ContentAlignment.MiddleLeft;
            point = new Point(3, 3);
            this.CmdThoat.Location = point;
            this.CmdThoat.Name = "CmdThoat";
            size = new Size(110, 0x20);
            this.CmdThoat.Size = size;
            this.CmdThoat.TabIndex = 2;
            this.CmdThoat.Text = "&Tho\x00e1t";
            this.CmdThoat.UseVisualStyleBackColor = true;
            this.cmdNhap.Image = ACCOUNTING.My.Resources.Resources.Adds;
            this.cmdNhap.ImageAlign = ContentAlignment.MiddleLeft;
            point = new Point(3, 3);
            this.cmdNhap.Location = point;
            this.cmdNhap.Name = "cmdNhap";
            size = new Size(110, 0x20);
            this.cmdNhap.Size = size;
            this.cmdNhap.TabIndex = 1;
            this.cmdNhap.Text = "&Nhập dữ liệu";
            this.cmdNhap.UseVisualStyleBackColor = true;
            SizeF ef = new SizeF(6f, 13f);
            this.AutoScaleDimensions = ef;
            this.AutoScaleMode = AutoScaleMode.Font;
            size = new Size(0x351, 0x1af);
            this.ClientSize = size;
            this.Controls.Add(this.Panel2);
            this.Controls.Add(this.Panel3);
            this.Controls.Add(this.Panel1);
            this.Name = "Frm_HienThiDuLieu";
            this.StartPosition = FormStartPosition.CenterScreen;
            this.Text = "NHAP DU LIEU TU EXCEL";
            this.Panel1.ResumeLayout(false);
            this.Panel1.PerformLayout();
            this.Panel7.ResumeLayout(false);
            this.Panel7.PerformLayout();
            this.Panel2.ResumeLayout(false);
            this.VSlist.EndInit();
            this.Panel3.ResumeLayout(false);
            this.Panel6.ResumeLayout(false);
            this.ResumeLayout(false);
        }

        public void KiemTraDanhMucDonViTinh()
        {
            clsDMDonViTinh tinh = new clsDMDonViTinh();
            C1.Win.C1FlexGrid.C1FlexGrid vSlist = this.VSlist;
            int num2 = this.VSlist.Rows.Count - 1;
            for (int i = 1; i <= num2; i++)
            {
                try
                {
                    if (Microsoft.VisualBasic.CompilerServices.Operators.ConditionalCompareObjectEqual(LVYModule.ReturnIfNull(vSlist[i, 0].ToString().Trim(), "", modGeneral.TypeOfValue.Nothing), "", false))
                    {
                        this.VSlist.RemoveItem(i);
                        i--;
                        if (i == (this.VSlist.Rows.Count - 1))
                        {
                            return;
                        }
                    }
                    else if (this.KtraTrungLap(i, 0, vSlist[i, 0].ToString().Trim()))
                    {
                        this.VSlist.RemoveItem(i);
                        i--;
                        if (i == (this.VSlist.Rows.Count - 1))
                        {
                            return;
                        }
                    }
                    else if (tinh.isDupplicateCode("LVY-DRAGON2", vSlist[i, 0].ToString()))
                    {
                        LVYModule.SetColorForGrid(this.VSlist, Color.Goldenrod, i, 0, 0, 0);
                        vSlist[i, 2] = 1;
                    }
                }
                catch (Exception exception1)
                {
                    ProjectData.SetProjectError(exception1);
                    Exception exception = exception1;
                    ProjectData.ClearProjectError();
                }
            }
            vSlist = null;
        }

        public void KiemTraDanhMucHangHoa()
        {
            clsDMHangHoa hoa = new clsDMHangHoa();
            clsDMNganhHang hang = new clsDMNganhHang();
            clsDMNhomHangHoa hoa2 = new clsDMNhomHangHoa();
            clsDMDonViTinh tinh = new clsDMDonViTinh();
            clsDMQuocGia gia = new clsDMQuocGia();
            clsDMHangSanXuat xuat = new clsDMHangSanXuat();
            clsDMTaiKhoan khoan = new clsDMTaiKhoan();
            C1.Win.C1FlexGrid.C1FlexGrid vSlist = this.VSlist;
            int num2 = this.VSlist.Rows.Count - 1;
            for (int i = 1; i <= num2; i++)
            {
                try
                {
                    if (Microsoft.VisualBasic.CompilerServices.Operators.ConditionalCompareObjectEqual(LVYModule.ReturnIfNull(vSlist[i, 0].ToString().Trim(), "", modGeneral.TypeOfValue.Nothing), "", false))
                    {
                        this.VSlist.RemoveItem(i);
                        i--;
                        if (i == (this.VSlist.Rows.Count - 1))
                        {
                            return;
                        }
                    }
                    else if (this.KtraTrungLap(i, 0, vSlist[i, 0].ToString().Trim()))
                    {
                        this.VSlist.RemoveItem(i);
                        i--;
                        if (i == (this.VSlist.Rows.Count - 1))
                        {
                            return;
                        }
                    }
                    else if (hoa.isDupplicateCode("LVY-DRAGON2", vSlist[i, 0].ToString()))
                    {
                        LVYModule.SetColorForGrid(this.VSlist, Color.Goldenrod, i, 0, 0, 0);
                        vSlist[i, 20] = 1;
                    }
                    else
                    {
                        if (Microsoft.VisualBasic.CompilerServices.Operators.ConditionalCompareObjectEqual(LVYModule.ReturnIfNull(vSlist[i, 1].ToString().Trim(), "", modGeneral.TypeOfValue.Nothing), "", false))
                        {
                            LVYModule.SetColorForGrid(this.VSlist, Color.Blue, i, 1, i, 1);
                            vSlist[i, 20] = 1;
                        }
                        if (hang.SearchByCode(Conversions.ToString(LVYModule.ReturnIfNull(this.VSlist[i, 2].ToString().Trim(), "LVY-DRAGON2", modGeneral.TypeOfValue.Nothing)), "") == "")
                        {
                            LVYModule.SetColorForGrid(this.VSlist, Color.Blue, i, 2, i, 2);
                            vSlist[i, 20] = 1;
                        }
                        if (hoa2.SearchByCode(Conversions.ToString(LVYModule.ReturnIfNull(this.VSlist[i, 3].ToString().Trim(), "LVY-DRAGON2", modGeneral.TypeOfValue.Nothing)), "", "") == "")
                        {
                            LVYModule.SetColorForGrid(this.VSlist, Color.Blue, i, 3, i, 3);
                            vSlist[i, 20] = 1;
                        }
                        if (tinh.SearchByCode(Conversions.ToString(LVYModule.ReturnIfNull(this.VSlist[i, 4].ToString().Trim(), "LVY-DRAGON2", modGeneral.TypeOfValue.Nothing)), "") == "")
                        {
                            LVYModule.SetColorForGrid(this.VSlist, Color.Blue, i, 4, i, 4);
                            vSlist[i, 20] = 1;
                        }
                        if (Microsoft.VisualBasic.CompilerServices.Operators.ConditionalCompareObjectNotEqual(LVYModule.ReturnIfNull(vSlist[i, 5].ToString().Trim(), "", modGeneral.TypeOfValue.Nothing), "", false) && (gia.SearchByCode(vSlist[i, 5].ToString().Trim(), "") == ""))
                        {
                            LVYModule.SetColorForGrid(this.VSlist, Color.Blue, i, 5, i, 5);
                            vSlist[i, 20] = 1;
                        }
                        if (Microsoft.VisualBasic.CompilerServices.Operators.ConditionalCompareObjectNotEqual(LVYModule.ReturnIfNull(vSlist[i, 6].ToString().Trim(), "", modGeneral.TypeOfValue.Nothing), "", false) && (xuat.SearchByCode(vSlist[i, 6].ToString().Trim()) == ""))
                        {
                            LVYModule.SetColorForGrid(this.VSlist, Color.Blue, i, 6, i, 6);
                            vSlist[i, 20] = 1;
                        }
                        if (Microsoft.VisualBasic.CompilerServices.Operators.ConditionalCompareObjectNotEqual(LVYModule.ReturnIfNull(vSlist[i, 12].ToString().Trim(), "", modGeneral.TypeOfValue.Nothing), "", false) && (khoan.SearchByCode(vSlist[i, 12].ToString().Trim(), "", "", "") == ""))
                        {
                            LVYModule.SetColorForGrid(this.VSlist, Color.Blue, i, 12, i, 12);
                            vSlist[i, 20] = 1;
                        }
                        if (Microsoft.VisualBasic.CompilerServices.Operators.ConditionalCompareObjectNotEqual(LVYModule.ReturnIfNull(vSlist[i, 13].ToString().Trim(), "", modGeneral.TypeOfValue.Nothing), "", false) && (khoan.SearchByCode(vSlist[i, 13].ToString().Trim(), "", "", "") == ""))
                        {
                            LVYModule.SetColorForGrid(this.VSlist, Color.Blue, i, 13, i, 13);
                            vSlist[i, 20] = 1;
                        }
                    }
                }
                catch (Exception exception1)
                {
                    ProjectData.SetProjectError(exception1);
                    Exception exception = exception1;
                    ProjectData.ClearProjectError();
                }
            }
            vSlist = null;
        }

        public void KiemTraDanhMucHangSanXuat()
        {
            clsDMHangSanXuat xuat = new clsDMHangSanXuat();
            C1.Win.C1FlexGrid.C1FlexGrid vSlist = this.VSlist;
            int num2 = this.VSlist.Rows.Count - 1;
            for (int i = 1; i <= num2; i++)
            {
                try
                {
                    if (Microsoft.VisualBasic.CompilerServices.Operators.ConditionalCompareObjectEqual(LVYModule.ReturnIfNull(vSlist[i, 0].ToString().Trim(), "", modGeneral.TypeOfValue.Nothing), "", false))
                    {
                        this.VSlist.RemoveItem(i);
                        i--;
                        if (i == (this.VSlist.Rows.Count - 1))
                        {
                            return;
                        }
                    }
                    else if (this.KtraTrungLap(i, 0, vSlist[i, 0].ToString().Trim()))
                    {
                        this.VSlist.RemoveItem(i);
                        i--;
                        if (i == (this.VSlist.Rows.Count - 1))
                        {
                            return;
                        }
                    }
                    else if (xuat.TrungMa(vSlist[i, 0].ToString(), "LVY-DRAGON2"))
                    {
                        LVYModule.SetColorForGrid(this.VSlist, Color.Goldenrod, i, 0, 0, 0);
                        vSlist[i, 3] = 1;
                    }
                    else if (Microsoft.VisualBasic.CompilerServices.Operators.ConditionalCompareObjectEqual(LVYModule.ReturnIfNull(vSlist[i, 1].ToString().Trim(), "", modGeneral.TypeOfValue.Nothing), "", false))
                    {
                        LVYModule.SetColorForGrid(this.VSlist, Color.Blue, i, 1, i, 1);
                        vSlist[i, 3] = 1;
                    }
                }
                catch (Exception exception1)
                {
                    ProjectData.SetProjectError(exception1);
                    Exception exception = exception1;
                    ProjectData.ClearProjectError();
                }
            }
            vSlist = null;
        }

        public void KiemTraDanhMucKhachHang()
        {
            clsDMDoiTuong tuong = new clsDMDoiTuong();
            clsDMNganhKinhDoanh doanh = new clsDMNganhKinhDoanh();
            clsDMLoaiKhachHang hang = new clsDMLoaiKhachHang();
            clsDMLoaiGia gia = new clsDMLoaiGia();
            clsDMKhuVuc vuc = new clsDMKhuVuc();
            C1.Win.C1FlexGrid.C1FlexGrid vSlist = this.VSlist;
            int num2 = this.VSlist.Rows.Count - 1;
            for (int i = 1; i <= num2; i++)
            {
                try
                {
                    if (Microsoft.VisualBasic.CompilerServices.Operators.ConditionalCompareObjectEqual(LVYModule.ReturnIfNull(vSlist[i, 0].ToString().Trim(), "", modGeneral.TypeOfValue.Nothing), "", false))
                    {
                        this.VSlist.RemoveItem(i);
                        i--;
                        if (i == (this.VSlist.Rows.Count - 1))
                        {
                            return;
                        }
                    }
                    else if (this.KtraTrungLap(i, 0, vSlist[i, 0].ToString().Trim()))
                    {
                        this.VSlist.RemoveItem(i);
                        i--;
                        if (i == (this.VSlist.Rows.Count - 1))
                        {
                            return;
                        }
                    }
                    else if (tuong.TrungMa(vSlist[i, 0].ToString(), "LVY-DRAGON2"))
                    {
                        LVYModule.SetColorForGrid(this.VSlist, Color.Goldenrod, i, 0, 0, 0);
                        vSlist[i, 13] = 1;
                    }
                    else
                    {
                        if (Microsoft.VisualBasic.CompilerServices.Operators.ConditionalCompareObjectEqual(LVYModule.ReturnIfNull(vSlist[i, 1].ToString().Trim(), "", modGeneral.TypeOfValue.Nothing), "", false))
                        {
                            LVYModule.SetColorForGrid(this.VSlist, Color.Blue, i, 1, i, 1);
                            vSlist[i, 13] = 1;
                        }
                        if (Microsoft.VisualBasic.CompilerServices.Operators.ConditionalCompareObjectNotEqual(LVYModule.ReturnIfNull(vSlist[i, 2].ToString().Trim(), "", modGeneral.TypeOfValue.Nothing), "", false) && (doanh.SearchByCode(vSlist[i, 2].ToString().Trim(), "") == ""))
                        {
                            LVYModule.SetColorForGrid(this.VSlist, Color.Blue, i, 2, i, 2);
                            vSlist[i, 13] = 1;
                        }
                        if (Microsoft.VisualBasic.CompilerServices.Operators.ConditionalCompareObjectNotEqual(LVYModule.ReturnIfNull(vSlist[i, 3].ToString().Trim(), "", modGeneral.TypeOfValue.Nothing), "", false) && (hang.SearchByCode(vSlist[i, 3].ToString().Trim(), "", "") == ""))
                        {
                            LVYModule.SetColorForGrid(this.VSlist, Color.Blue, i, 3, i, 3);
                            vSlist[i, 13] = 1;
                        }
                        if (Microsoft.VisualBasic.CompilerServices.Operators.ConditionalCompareObjectNotEqual(LVYModule.ReturnIfNull(vSlist[i, 4].ToString().Trim(), "", modGeneral.TypeOfValue.Nothing), "", false) && (gia.SearchByCode(vSlist[i, 4].ToString().Trim(), "", "") == ""))
                        {
                            LVYModule.SetColorForGrid(this.VSlist, Color.Blue, i, 4, i, 4);
                            vSlist[i, 13] = 1;
                        }
                        if (Microsoft.VisualBasic.CompilerServices.Operators.ConditionalCompareObjectNotEqual(LVYModule.ReturnIfNull(vSlist[i, 5].ToString().Trim(), "", modGeneral.TypeOfValue.Nothing), "", false) && (vuc.SearchByCode(vSlist[i, 5].ToString().Trim(), "", "") == ""))
                        {
                            LVYModule.SetColorForGrid(this.VSlist, Color.Blue, i, 5, i, 5);
                            vSlist[i, 13] = 1;
                        }
                    }
                }
                catch (Exception exception1)
                {
                    ProjectData.SetProjectError(exception1);
                    Exception exception = exception1;
                    ProjectData.ClearProjectError();
                }
            }
            vSlist = null;
        }

        public void KiemTraDanhMucKho()
        {
            clsDMKho kho = new clsDMKho();
            C1.Win.C1FlexGrid.C1FlexGrid vSlist = this.VSlist;
            int num2 = this.VSlist.Rows.Count - 1;
            for (int i = 1; i <= num2; i++)
            {
                try
                {
                    if (Microsoft.VisualBasic.CompilerServices.Operators.ConditionalCompareObjectEqual(LVYModule.ReturnIfNull(vSlist[i, 0].ToString().Trim(), "", modGeneral.TypeOfValue.Nothing), "", false))
                    {
                        this.VSlist.RemoveItem(i);
                        i--;
                        if (i == (this.VSlist.Rows.Count - 1))
                        {
                            return;
                        }
                    }
                    else if (this.KtraTrungLap(i, 0, vSlist[i, 0].ToString().Trim()))
                    {
                        this.VSlist.RemoveItem(i);
                        i--;
                        if (i == (this.VSlist.Rows.Count - 1))
                        {
                            return;
                        }
                    }
                    else if (kho.TrungMa(vSlist[i, 0].ToString(), "LVY-DRAGON2"))
                    {
                        LVYModule.SetColorForGrid(this.VSlist, Color.Goldenrod, i, 0, 0, 0);
                        vSlist[i, 3] = 1;
                    }
                    else if (Microsoft.VisualBasic.CompilerServices.Operators.ConditionalCompareObjectEqual(LVYModule.ReturnIfNull(vSlist[i, 1].ToString().Trim(), "", modGeneral.TypeOfValue.Nothing), "", false))
                    {
                        LVYModule.SetColorForGrid(this.VSlist, Color.Blue, i, 1, i, 1);
                        vSlist[i, 3] = 1;
                    }
                }
                catch (Exception exception1)
                {
                    ProjectData.SetProjectError(exception1);
                    Exception exception = exception1;
                    ProjectData.ClearProjectError();
                }
            }
            vSlist = null;
        }

        public void KiemTraDanhMucLoaiKhachHang()
        {
            clsDMLoaiKhachHang hang = new clsDMLoaiKhachHang();
            C1.Win.C1FlexGrid.C1FlexGrid vSlist = this.VSlist;
            int num2 = this.VSlist.Rows.Count - 1;
            for (int i = 1; i <= num2; i++)
            {
                try
                {
                    if (Microsoft.VisualBasic.CompilerServices.Operators.ConditionalCompareObjectEqual(LVYModule.ReturnIfNull(vSlist[i, 0].ToString().Trim(), "", modGeneral.TypeOfValue.Nothing), "", false))
                    {
                        this.VSlist.RemoveItem(i);
                        i--;
                        if (i == (this.VSlist.Rows.Count - 1))
                        {
                            return;
                        }
                    }
                    else if (this.KtraTrungLap(i, 0, vSlist[i, 0].ToString().Trim()))
                    {
                        this.VSlist.RemoveItem(i);
                        i--;
                        if (i == (this.VSlist.Rows.Count - 1))
                        {
                            return;
                        }
                    }
                    else if (hang.TrungMa(vSlist[i, 0].ToString(), "LVY-DRAGON2"))
                    {
                        LVYModule.SetColorForGrid(this.VSlist, Color.Goldenrod, i, 0, 0, 0);
                        vSlist[i, 3] = 1;
                    }
                    else if (Microsoft.VisualBasic.CompilerServices.Operators.ConditionalCompareObjectEqual(LVYModule.ReturnIfNull(vSlist[i, 1].ToString().Trim(), "", modGeneral.TypeOfValue.Nothing), "", false))
                    {
                        LVYModule.SetColorForGrid(this.VSlist, Color.Blue, i, 1, i, 1);
                        vSlist[i, 3] = 1;
                    }
                }
                catch (Exception exception1)
                {
                    ProjectData.SetProjectError(exception1);
                    Exception exception = exception1;
                    ProjectData.ClearProjectError();
                }
            }
            vSlist = null;
        }

        public void KiemTraDanhMucNganhHang()
        {
            clsDMNganhHang hang = new clsDMNganhHang();
            C1.Win.C1FlexGrid.C1FlexGrid vSlist = this.VSlist;
            int num2 = this.VSlist.Rows.Count - 1;
            for (int i = 1; i <= num2; i++)
            {
                try
                {
                    if (Microsoft.VisualBasic.CompilerServices.Operators.ConditionalCompareObjectEqual(LVYModule.ReturnIfNull(vSlist[i, 0].ToString().Trim(), "", modGeneral.TypeOfValue.Nothing), "", false))
                    {
                        this.VSlist.RemoveItem(i);
                        i--;
                        if (i == (this.VSlist.Rows.Count - 1))
                        {
                            return;
                        }
                    }
                    else if (this.KtraTrungLap(i, 0, vSlist[i, 0].ToString().Trim()))
                    {
                        this.VSlist.RemoveItem(i);
                        i--;
                        if (i == (this.VSlist.Rows.Count - 1))
                        {
                            return;
                        }
                    }
                    else if (hang.TrungMa(vSlist[i, 0].ToString(), "LVY-DRAGON2"))
                    {
                        LVYModule.SetColorForGrid(this.VSlist, Color.Goldenrod, i, 0, 0, 0);
                        vSlist[i, 3] = 1;
                    }
                    else if (Microsoft.VisualBasic.CompilerServices.Operators.ConditionalCompareObjectEqual(LVYModule.ReturnIfNull(vSlist[i, 1].ToString().Trim(), "", modGeneral.TypeOfValue.Nothing), "", false))
                    {
                        LVYModule.SetColorForGrid(this.VSlist, Color.Blue, i, 1, i, 1);
                        vSlist[i, 3] = 1;
                    }
                }
                catch (Exception exception1)
                {
                    ProjectData.SetProjectError(exception1);
                    Exception exception = exception1;
                    ProjectData.ClearProjectError();
                }
            }
            vSlist = null;
        }

        public void KiemTraDanhMucNganhKinhDoanh()
        {
            clsDMNganhKinhDoanh doanh = new clsDMNganhKinhDoanh();
            C1.Win.C1FlexGrid.C1FlexGrid vSlist = this.VSlist;
            int num2 = this.VSlist.Rows.Count - 1;
            for (int i = 1; i <= num2; i++)
            {
                try
                {
                    if (Microsoft.VisualBasic.CompilerServices.Operators.ConditionalCompareObjectEqual(LVYModule.ReturnIfNull(vSlist[i, 0].ToString().Trim(), "", modGeneral.TypeOfValue.Nothing), "", false))
                    {
                        this.VSlist.RemoveItem(i);
                        i--;
                        if (i == (this.VSlist.Rows.Count - 1))
                        {
                            return;
                        }
                    }
                    else if (this.KtraTrungLap(i, 0, vSlist[i, 0].ToString().Trim()))
                    {
                        this.VSlist.RemoveItem(i);
                        i--;
                        if (i == (this.VSlist.Rows.Count - 1))
                        {
                            return;
                        }
                    }
                    else if (doanh.TrungMa(vSlist[i, 0].ToString(), "LVY-DRAGON2"))
                    {
                        LVYModule.SetColorForGrid(this.VSlist, Color.Goldenrod, i, 0, 0, 0);
                        vSlist[i, 3] = 1;
                    }
                    else if (Microsoft.VisualBasic.CompilerServices.Operators.ConditionalCompareObjectEqual(LVYModule.ReturnIfNull(vSlist[i, 1].ToString().Trim(), "", modGeneral.TypeOfValue.Nothing), "", false))
                    {
                        LVYModule.SetColorForGrid(this.VSlist, Color.Blue, i, 1, i, 1);
                        vSlist[i, 3] = 1;
                    }
                }
                catch (Exception exception1)
                {
                    ProjectData.SetProjectError(exception1);
                    Exception exception = exception1;
                    ProjectData.ClearProjectError();
                }
            }
            vSlist = null;
        }

        public void KiemTraDanhMucNhaCungCap()
        {
            clsDMDoiTuong tuong = new clsDMDoiTuong();
            clsDMNganhKinhDoanh doanh = new clsDMNganhKinhDoanh();
            C1.Win.C1FlexGrid.C1FlexGrid vSlist = this.VSlist;
            int num2 = this.VSlist.Rows.Count - 1;
            for (int i = 1; i <= num2; i++)
            {
                try
                {
                    if (Microsoft.VisualBasic.CompilerServices.Operators.ConditionalCompareObjectEqual(LVYModule.ReturnIfNull(vSlist[i, 0].ToString().Trim(), "", modGeneral.TypeOfValue.Nothing), "", false))
                    {
                        this.VSlist.RemoveItem(i);
                        i--;
                        if (i == (this.VSlist.Rows.Count - 1))
                        {
                            return;
                        }
                    }
                    else if (this.KtraTrungLap(i, 0, vSlist[i, 0].ToString().Trim()))
                    {
                        this.VSlist.RemoveItem(i);
                        i--;
                        if (i == (this.VSlist.Rows.Count - 1))
                        {
                            return;
                        }
                    }
                    else if (tuong.TrungMa(vSlist[i, 0].ToString(), "LVY-DRAGON2"))
                    {
                        LVYModule.SetColorForGrid(this.VSlist, Color.Goldenrod, i, 0, 0, 0);
                        vSlist[i, 10] = 1;
                    }
                    else
                    {
                        if (Microsoft.VisualBasic.CompilerServices.Operators.ConditionalCompareObjectEqual(LVYModule.ReturnIfNull(vSlist[i, 1].ToString().Trim(), "", modGeneral.TypeOfValue.Nothing), "", false))
                        {
                            LVYModule.SetColorForGrid(this.VSlist, Color.Blue, i, 1, i, 1);
                            vSlist[i, 10] = 1;
                        }
                        if (Microsoft.VisualBasic.CompilerServices.Operators.ConditionalCompareObjectNotEqual(LVYModule.ReturnIfNull(vSlist[i, 2].ToString().Trim(), "", modGeneral.TypeOfValue.Nothing), "", false) && (doanh.SearchByCode(vSlist[i, 2].ToString().Trim(), "") == ""))
                        {
                            LVYModule.SetColorForGrid(this.VSlist, Color.Blue, i, 2, i, 2);
                            vSlist[i, 10] = 1;
                        }
                    }
                }
                catch (Exception exception1)
                {
                    ProjectData.SetProjectError(exception1);
                    Exception exception = exception1;
                    ProjectData.ClearProjectError();
                }
            }
            vSlist = null;
        }

        public void KiemTraDanhMucNhomHangHoa()
        {
            clsDMNhomHangHoa hoa = new clsDMNhomHangHoa();
            clsDMNganhHang hang = new clsDMNganhHang();
            clsDMTaiKhoan khoan = new clsDMTaiKhoan();
            C1.Win.C1FlexGrid.C1FlexGrid vSlist = this.VSlist;
            int num2 = this.VSlist.Rows.Count - 1;
            for (int i = 1; i <= num2; i++)
            {
                try
                {
                    if (Microsoft.VisualBasic.CompilerServices.Operators.ConditionalCompareObjectEqual(LVYModule.ReturnIfNull(vSlist[i, 0].ToString().Trim(), "", modGeneral.TypeOfValue.Nothing), "", false))
                    {
                        this.VSlist.RemoveItem(i);
                        i--;
                        if (i == (this.VSlist.Rows.Count - 1))
                        {
                            return;
                        }
                    }
                    else if (this.KtraTrungLap(i, 0, vSlist[i, 0].ToString().Trim()))
                    {
                        this.VSlist.RemoveItem(i);
                        i--;
                        if (i == (this.VSlist.Rows.Count - 1))
                        {
                            return;
                        }
                    }
                    else if (hoa.TrungMa(vSlist[i, 0].ToString(), "LVY-DRAGON2"))
                    {
                        LVYModule.SetColorForGrid(this.VSlist, Color.Goldenrod, i, 0, 0, 0);
                        vSlist[i, 5] = 1;
                    }
                    else
                    {
                        if (Microsoft.VisualBasic.CompilerServices.Operators.ConditionalCompareObjectEqual(LVYModule.ReturnIfNull(vSlist[i, 1].ToString().Trim(), "", modGeneral.TypeOfValue.Nothing), "", false))
                        {
                            LVYModule.SetColorForGrid(this.VSlist, Color.Blue, i, 1, i, 1);
                            vSlist[i, 5] = 1;
                        }
                        if (hang.SearchByCode(Conversions.ToString(LVYModule.ReturnIfNull(vSlist[i, 2].ToString().Trim(), "LVY-DRAGON2", modGeneral.TypeOfValue.Nothing)), "") == "")
                        {
                            LVYModule.SetColorForGrid(this.VSlist, Color.Blue, i, 2, i, 2);
                            vSlist[i, 5] = 1;
                        }
                        if (khoan.SearchByCode(Conversions.ToString(LVYModule.ReturnIfNull(vSlist[i, 3].ToString().Trim(), "LVY-DRAGON2", modGeneral.TypeOfValue.Nothing)), "", "", "") == "")
                        {
                            LVYModule.SetColorForGrid(this.VSlist, Color.Blue, i, 3, i, 3);
                            vSlist[i, 5] = 1;
                        }
                        if (khoan.SearchByCode(Conversions.ToString(LVYModule.ReturnIfNull(vSlist[i, 4].ToString().Trim(), "LVY-DRAGON2", modGeneral.TypeOfValue.Nothing)), "", "", "") == "")
                        {
                            LVYModule.SetColorForGrid(this.VSlist, Color.Blue, i, 4, i, 4);
                            vSlist[i, 5] = 1;
                        }
                    }
                }
                catch (Exception exception1)
                {
                    ProjectData.SetProjectError(exception1);
                    Exception exception = exception1;
                    ProjectData.ClearProjectError();
                }
            }
            vSlist = null;
        }

        public void KiemTraDanhMucQuocGia()
        {
            clsDMQuocGia gia = new clsDMQuocGia();
            C1.Win.C1FlexGrid.C1FlexGrid vSlist = this.VSlist;
            int num2 = this.VSlist.Rows.Count - 1;
            for (int i = 1; i <= num2; i++)
            {
                try
                {
                    if (Microsoft.VisualBasic.CompilerServices.Operators.ConditionalCompareObjectEqual(LVYModule.ReturnIfNull(vSlist[i, 0].ToString().Trim(), "", modGeneral.TypeOfValue.Nothing), "", false))
                    {
                        this.VSlist.RemoveItem(i);
                        i--;
                        if (i == (this.VSlist.Rows.Count - 1))
                        {
                            return;
                        }
                    }
                    else if (this.KtraTrungLap(i, 0, vSlist[i, 0].ToString().Trim()))
                    {
                        this.VSlist.RemoveItem(i);
                        i--;
                        if (i == (this.VSlist.Rows.Count - 1))
                        {
                            return;
                        }
                    }
                    else if (gia.TrungMa(vSlist[i, 0].ToString(), "LVY-DRAGON2"))
                    {
                        LVYModule.SetColorForGrid(this.VSlist, Color.Goldenrod, i, 0, 0, 0);
                        vSlist[i, 3] = 1;
                    }
                    else if (Microsoft.VisualBasic.CompilerServices.Operators.ConditionalCompareObjectEqual(LVYModule.ReturnIfNull(vSlist[i, 1].ToString().Trim(), "", modGeneral.TypeOfValue.Nothing), "", false))
                    {
                        LVYModule.SetColorForGrid(this.VSlist, Color.Blue, i, 1, i, 1);
                        vSlist[i, 3] = 1;
                    }
                }
                catch (Exception exception1)
                {
                    ProjectData.SetProjectError(exception1);
                    Exception exception = exception1;
                    ProjectData.ClearProjectError();
                }
            }
            vSlist = null;
        }

        public object KtraFileExcel(string sheet)
        {
            switch (this.strLoai)
            {
                case "E001":
                    if (sheet == "DanhMucDonViTinh_")
                    {
                        return true;
                    }
                    break;

                case "E002":
                    if (sheet == "DanhMucHangSanXuat_")
                    {
                        return true;
                    }
                    break;

                case "E003":
                    if (sheet == "DanhMucLoaiKhachHang_")
                    {
                        return true;
                    }
                    break;

                case "E004":
                    if (sheet == "DanhMucNganhHang_")
                    {
                        return true;
                    }
                    break;

                case "E005":
                    if (sheet == "DanhMucNganhKinhDoanh_")
                    {
                        return true;
                    }
                    break;

                case "E006":
                    if (sheet == "DanhMucQuocGia_")
                    {
                        return true;
                    }
                    break;

                case "E007":
                    if (sheet == "DanhMucNhomHangHoa_")
                    {
                        return true;
                    }
                    break;

                case "E008":
                    if (sheet == "DanhMucKhachHang_")
                    {
                        return true;
                    }
                    break;

                case "E009":
                    if (sheet == "DanhMucNhaCungCap_")
                    {
                        return true;
                    }
                    break;

                case "E010":
                    if (sheet == "DanhMucHangHoa_")
                    {
                        return true;
                    }
                    break;

                case "E011":
                    if (sheet == "DanhMucKho_")
                    {
                        return true;
                    }
                    break;

                default:
                    return false;
            }
            return false;
        }

        public bool KtraTrungLap(int intRows, int intCols, string Gtri)
        {
            C1.Win.C1FlexGrid.C1FlexGrid vSlist = this.VSlist;
            int num2 = intRows - 1;
            for (int i = 1; i <= num2; i++)
            {
                if (Microsoft.VisualBasic.CompilerServices.Operators.ConditionalCompareObjectEqual(vSlist[i, intCols], Gtri, false))
                {
                    return true;
                }
            }
            vSlist = null;
            return false;
        }

        public void LoadDanhMucDonViTinh(DataTable ptbl)
        {
            int num;
            C1.Win.C1FlexGrid.C1FlexGrid vSlist = this.VSlist;
            vSlist.Rows.Count = 1;
            vSlist.Cols[0].Width = 300;
            vSlist.Cols[0].Caption = "T\x00ean ĐVT";
            vSlist.Cols[0].TextAlignFixed = TextAlignEnum.CenterCenter;
            vSlist.Cols[1].Caption = "Diễn giải";
            vSlist.Cols[1].TextAlignFixed = TextAlignEnum.CenterCenter;
            int num2 = ptbl.Rows.Count - 1;
            for (num = 0; num <= num2; num++)
            {
                vSlist.AddItem("");
                vSlist[vSlist.Rows.Count - 1, 0] = RuntimeHelpers.GetObjectValue(ptbl.Rows[num][0]);
                vSlist[vSlist.Rows.Count - 1, 1] = RuntimeHelpers.GetObjectValue(ptbl.Rows[num][1]);
                vSlist[vSlist.Rows.Count - 1, 2] = 0;
            }
            vSlist = null;
            int num3 = this.VSlist.Cols.Count - 1;
            for (num = 2; num <= num3; num++)
            {
                this.VSlist.Cols[num].Visible = false;
            }
            this.KiemTraDanhMucDonViTinh();
        }

        public void LoadDanhMucHangHoa(DataTable ptbl)
        {
            int num;
            C1.Win.C1FlexGrid.C1FlexGrid vSlist = this.VSlist;
            vSlist.Rows.Count = 1;
            vSlist.Cols[0].Width = 100;
            vSlist.Cols[0].Caption = "M\x00e3 HH";
            vSlist.Cols[0].TextAlignFixed = TextAlignEnum.CenterCenter;
            vSlist.Cols[1].Width = 250;
            vSlist.Cols[1].Caption = "T\x00ean HH";
            vSlist.Cols[1].TextAlignFixed = TextAlignEnum.CenterCenter;
            vSlist.Cols[2].Width = 100;
            vSlist.Cols[2].Caption = "M\x00e3 ng\x00e0nh h\x00e0ng";
            vSlist.Cols[2].TextAlignFixed = TextAlignEnum.CenterCenter;
            vSlist.Cols[3].Width = 100;
            vSlist.Cols[3].Caption = "M\x00e3 nh\x00f3m HH";
            vSlist.Cols[3].TextAlignFixed = TextAlignEnum.CenterCenter;
            vSlist.Cols[4].Width = 100;
            vSlist.Cols[4].Caption = "M\x00e3 ĐVT";
            vSlist.Cols[4].TextAlignFixed = TextAlignEnum.CenterCenter;
            vSlist.Cols[5].Width = 100;
            vSlist.Cols[5].Caption = "M\x00e3 Q.Gia";
            vSlist.Cols[5].TextAlignFixed = TextAlignEnum.CenterCenter;
            vSlist.Cols[6].Width = 100;
            vSlist.Cols[6].Caption = "M\x00e3 HSX";
            vSlist.Cols[6].TextAlignFixed = TextAlignEnum.CenterCenter;
            vSlist.Cols[7].Width = 150;
            vSlist.Cols[7].Caption = "M\x00e3 vạch";
            vSlist.Cols[7].TextAlignFixed = TextAlignEnum.CenterCenter;
            vSlist.Cols[8].Width = 150;
            vSlist.Cols[8].Caption = "M\x00e3 h\x00e0ng N.Khẩu";
            vSlist.Cols[8].TextAlignFixed = TextAlignEnum.CenterCenter;
            vSlist.Cols[9].Width = 150;
            vSlist.Cols[9].Caption = "M\x00e3 theo h\x00e3ng";
            vSlist.Cols[9].TextAlignFixed = TextAlignEnum.CenterCenter;
            vSlist.Cols[10].Width = 150;
            vSlist.Cols[10].Caption = "SL tồn tối thiểu";
            vSlist.Cols[10].TextAlignFixed = TextAlignEnum.CenterCenter;
            vSlist.Cols[11].Width = 150;
            vSlist.Cols[11].Caption = "TG bảo h\x00e0nh";
            vSlist.Cols[11].TextAlignFixed = TextAlignEnum.CenterCenter;
            vSlist.Cols[12].Width = 150;
            vSlist.Cols[12].Caption = "T.Khoản h\x00e0ng h\x00f3a";
            vSlist.Cols[12].TextAlignFixed = TextAlignEnum.CenterCenter;
            vSlist.Cols[13].Width = 150;
            vSlist.Cols[13].Caption = "T.Khoản gi\x00e1 vốn";
            vSlist.Cols[13].TextAlignFixed = TextAlignEnum.CenterCenter;
            vSlist.Cols[14].Width = 150;
            vSlist.Cols[14].Caption = "TL thuế";
            vSlist.Cols[14].TextAlignFixed = TextAlignEnum.CenterCenter;
            vSlist.Cols[15].Width = 150;
            vSlist.Cols[15].Caption = "TL thuế N.Khẩu";
            vSlist.Cols[15].TextAlignFixed = TextAlignEnum.CenterCenter;
            vSlist.Cols[0x10].Width = 200;
            vSlist.Cols[0x10].Caption = "Th\x00f4ng số kỹ thuật";
            vSlist.Cols[0x10].TextAlignFixed = TextAlignEnum.CenterCenter;
            vSlist.Cols[0x11].Width = 150;
            vSlist.Cols[0x11].Caption = "Trọng lượng";
            vSlist.Cols[0x11].TextAlignFixed = TextAlignEnum.CenterCenter;
            vSlist.Cols[0x12].Width = 150;
            vSlist.Cols[0x12].Caption = "K\x00edch thước";
            vSlist.Cols[0x12].TextAlignFixed = TextAlignEnum.CenterCenter;
            vSlist.Cols[0x13].Width = 150;
            vSlist.Cols[0x13].Caption = "Theo d\x00f5i bảo h\x00e0nh";
            vSlist.Cols[0x13].TextAlignFixed = TextAlignEnum.CenterCenter;
            int num2 = ptbl.Rows.Count - 1;
            for (num = 0; num <= num2; num++)
            {
                vSlist.AddItem("");
                vSlist[vSlist.Rows.Count - 1, 0] = RuntimeHelpers.GetObjectValue(ptbl.Rows[num][0]);
                vSlist[vSlist.Rows.Count - 1, 1] = RuntimeHelpers.GetObjectValue(ptbl.Rows[num][1]);
                vSlist[vSlist.Rows.Count - 1, 2] = RuntimeHelpers.GetObjectValue(ptbl.Rows[num][2]);
                vSlist[vSlist.Rows.Count - 1, 3] = RuntimeHelpers.GetObjectValue(ptbl.Rows[num][3]);
                vSlist[vSlist.Rows.Count - 1, 4] = RuntimeHelpers.GetObjectValue(ptbl.Rows[num][4]);
                vSlist[vSlist.Rows.Count - 1, 5] = RuntimeHelpers.GetObjectValue(ptbl.Rows[num][5]);
                vSlist[vSlist.Rows.Count - 1, 6] = RuntimeHelpers.GetObjectValue(ptbl.Rows[num][6]);
                vSlist[vSlist.Rows.Count - 1, 7] = RuntimeHelpers.GetObjectValue(ptbl.Rows[num][7]);
                vSlist[vSlist.Rows.Count - 1, 8] = RuntimeHelpers.GetObjectValue(ptbl.Rows[num][8]);
                vSlist[vSlist.Rows.Count - 1, 9] = RuntimeHelpers.GetObjectValue(ptbl.Rows[num][9]);
                vSlist[vSlist.Rows.Count - 1, 10] = RuntimeHelpers.GetObjectValue(ptbl.Rows[num][10]);
                vSlist[vSlist.Rows.Count - 1, 11] = RuntimeHelpers.GetObjectValue(ptbl.Rows[num][11]);
                vSlist[vSlist.Rows.Count - 1, 12] = RuntimeHelpers.GetObjectValue(ptbl.Rows[num][12]);
                vSlist[vSlist.Rows.Count - 1, 13] = RuntimeHelpers.GetObjectValue(ptbl.Rows[num][13]);
                vSlist[vSlist.Rows.Count - 1, 14] = RuntimeHelpers.GetObjectValue(ptbl.Rows[num][14]);
                vSlist[vSlist.Rows.Count - 1, 15] = RuntimeHelpers.GetObjectValue(ptbl.Rows[num][15]);
                vSlist[vSlist.Rows.Count - 1, 0x10] = RuntimeHelpers.GetObjectValue(ptbl.Rows[num][0x10]);
                vSlist[vSlist.Rows.Count - 1, 0x11] = RuntimeHelpers.GetObjectValue(ptbl.Rows[num][0x11]);
                vSlist[vSlist.Rows.Count - 1, 0x12] = RuntimeHelpers.GetObjectValue(ptbl.Rows[num][0x12]);
                vSlist[vSlist.Rows.Count - 1, 0x13] = RuntimeHelpers.GetObjectValue(ptbl.Rows[num][0x13]);
                vSlist[vSlist.Rows.Count - 1, 20] = 0;
            }
            vSlist = null;
            int num3 = this.VSlist.Cols.Count - 1;
            for (num = 20; num <= num3; num++)
            {
                this.VSlist.Cols[num].Visible = false;
            }
            this.KiemTraDanhMucHangHoa();
        }

        public void LoadDanhMucHangSanXuat(DataTable ptbl)
        {
            int num;
            C1.Win.C1FlexGrid.C1FlexGrid vSlist = this.VSlist;
            vSlist.Rows.Count = 1;
            vSlist.Cols[0].Width = 100;
            vSlist.Cols[0].Caption = "M\x00e3 HSX";
            vSlist.Cols[0].TextAlignFixed = TextAlignEnum.CenterCenter;
            vSlist.Cols[1].Width = 300;
            vSlist.Cols[1].Caption = "T\x00ean HSX";
            vSlist.Cols[1].TextAlignFixed = TextAlignEnum.CenterCenter;
            vSlist.Cols[2].Caption = "Diễn giải";
            vSlist.Cols[2].TextAlignFixed = TextAlignEnum.CenterCenter;
            int num2 = ptbl.Rows.Count - 1;
            for (num = 0; num <= num2; num++)
            {
                vSlist.AddItem("");
                vSlist[vSlist.Rows.Count - 1, 0] = RuntimeHelpers.GetObjectValue(ptbl.Rows[num][0]);
                vSlist[vSlist.Rows.Count - 1, 1] = RuntimeHelpers.GetObjectValue(ptbl.Rows[num][1]);
                vSlist[vSlist.Rows.Count - 1, 2] = RuntimeHelpers.GetObjectValue(ptbl.Rows[num][2]);
                vSlist[vSlist.Rows.Count - 1, 3] = 0;
            }
            vSlist = null;
            int num3 = this.VSlist.Cols.Count - 1;
            for (num = 3; num <= num3; num++)
            {
                this.VSlist.Cols[num].Visible = false;
            }
            this.KiemTraDanhMucHangSanXuat();
        }

        public void LoadDanhMucKhachHang(DataTable ptbl)
        {
            int num;
            C1.Win.C1FlexGrid.C1FlexGrid vSlist = this.VSlist;
            vSlist.Rows.Count = 1;
            vSlist.Cols[0].Width = 100;
            vSlist.Cols[0].Caption = "M\x00e3 KH";
            vSlist.Cols[0].TextAlignFixed = TextAlignEnum.CenterCenter;
            vSlist.Cols[1].Width = 250;
            vSlist.Cols[1].Caption = "T\x00ean KH";
            vSlist.Cols[1].TextAlignFixed = TextAlignEnum.CenterCenter;
            vSlist.Cols[2].Width = 100;
            vSlist.Cols[2].Caption = "M\x00e3 ng\x00e0nh KD";
            vSlist.Cols[2].TextAlignFixed = TextAlignEnum.CenterCenter;
            vSlist.Cols[3].Width = 100;
            vSlist.Cols[3].Caption = "M\x00e3 loại KH";
            vSlist.Cols[3].TextAlignFixed = TextAlignEnum.CenterCenter;
            vSlist.Cols[4].Width = 100;
            vSlist.Cols[4].Caption = "M\x00e3 loại gi\x00e1";
            vSlist.Cols[4].TextAlignFixed = TextAlignEnum.CenterCenter;
            vSlist.Cols[5].Width = 100;
            vSlist.Cols[5].Caption = "M\x00e3 khu vực";
            vSlist.Cols[5].TextAlignFixed = TextAlignEnum.CenterCenter;
            vSlist.Cols[6].Width = 250;
            vSlist.Cols[6].Caption = "Địa chỉ";
            vSlist.Cols[6].TextAlignFixed = TextAlignEnum.CenterCenter;
            vSlist.Cols[7].Width = 150;
            vSlist.Cols[7].Caption = "Điện thoại";
            vSlist.Cols[7].TextAlignFixed = TextAlignEnum.CenterCenter;
            vSlist.Cols[8].Width = 150;
            vSlist.Cols[8].Caption = "Fax";
            vSlist.Cols[8].TextAlignFixed = TextAlignEnum.CenterCenter;
            vSlist.Cols[9].Width = 150;
            vSlist.Cols[9].Caption = "Email";
            vSlist.Cols[9].TextAlignFixed = TextAlignEnum.CenterCenter;
            vSlist.Cols[10].Width = 150;
            vSlist.Cols[10].Caption = "Website";
            vSlist.Cols[10].TextAlignFixed = TextAlignEnum.CenterCenter;
            vSlist.Cols[11].Width = 150;
            vSlist.Cols[11].Caption = "M\x00e3 số thuế";
            vSlist.Cols[11].TextAlignFixed = TextAlignEnum.CenterCenter;
            vSlist.Cols[12].Width = 100;
            vSlist.Cols[12].Caption = "Vừa l\x00e0 nh\x00e0 cung cấp";
            vSlist.Cols[12].TextAlignFixed = TextAlignEnum.CenterCenter;
            vSlist.Cols[12].DataType = typeof(bool);
            int num2 = ptbl.Rows.Count - 1;
            for (num = 0; num <= num2; num++)
            {
                vSlist.AddItem("");
                vSlist[vSlist.Rows.Count - 1, 0] = RuntimeHelpers.GetObjectValue(ptbl.Rows[num][0]);
                vSlist[vSlist.Rows.Count - 1, 1] = RuntimeHelpers.GetObjectValue(ptbl.Rows[num][1]);
                vSlist[vSlist.Rows.Count - 1, 2] = RuntimeHelpers.GetObjectValue(ptbl.Rows[num][2]);
                vSlist[vSlist.Rows.Count - 1, 3] = RuntimeHelpers.GetObjectValue(ptbl.Rows[num][3]);
                vSlist[vSlist.Rows.Count - 1, 4] = RuntimeHelpers.GetObjectValue(ptbl.Rows[num][4]);
                vSlist[vSlist.Rows.Count - 1, 5] = RuntimeHelpers.GetObjectValue(ptbl.Rows[num][5]);
                vSlist[vSlist.Rows.Count - 1, 6] = RuntimeHelpers.GetObjectValue(ptbl.Rows[num][6]);
                vSlist[vSlist.Rows.Count - 1, 7] = RuntimeHelpers.GetObjectValue(ptbl.Rows[num][7]);
                vSlist[vSlist.Rows.Count - 1, 8] = RuntimeHelpers.GetObjectValue(ptbl.Rows[num][8]);
                vSlist[vSlist.Rows.Count - 1, 9] = RuntimeHelpers.GetObjectValue(ptbl.Rows[num][9]);
                vSlist[vSlist.Rows.Count - 1, 10] = RuntimeHelpers.GetObjectValue(ptbl.Rows[num][10]);
                vSlist[vSlist.Rows.Count - 1, 11] = RuntimeHelpers.GetObjectValue(ptbl.Rows[num][11]);
                if (Microsoft.VisualBasic.CompilerServices.Operators.ConditionalCompareObjectEqual(LVYModule.ReturnIfNull(RuntimeHelpers.GetObjectValue(ptbl.Rows[num][12]), 0, modGeneral.TypeOfValue.Nothing), 0, false))
                {
                    vSlist[vSlist.Rows.Count - 1, 12] = 0;
                }
                else
                {
                    vSlist[vSlist.Rows.Count - 1, 12] = -1;
                }
                vSlist[vSlist.Rows.Count - 1, 13] = 0;
            }
            vSlist = null;
            int num3 = this.VSlist.Cols.Count - 1;
            for (num = 13; num <= num3; num++)
            {
                this.VSlist.Cols[num].Visible = false;
            }
            this.KiemTraDanhMucKhachHang();
        }

        public void LoadDanhMucKho(DataTable ptbl)
        {
            int num;
            C1.Win.C1FlexGrid.C1FlexGrid vSlist = this.VSlist;
            vSlist.Rows.Count = 1;
            vSlist.Cols[0].Width = 100;
            vSlist.Cols[0].Caption = "M\x00e3 Kho";
            vSlist.Cols[0].TextAlignFixed = TextAlignEnum.CenterCenter;
            vSlist.Cols[1].Width = 300;
            vSlist.Cols[1].Caption = "T\x00ean Kho";
            vSlist.Cols[1].TextAlignFixed = TextAlignEnum.CenterCenter;
            vSlist.Cols[2].Caption = "Diễn giải";
            vSlist.Cols[2].TextAlignFixed = TextAlignEnum.CenterCenter;
            int num2 = ptbl.Rows.Count - 1;
            for (num = 0; num <= num2; num++)
            {
                vSlist.AddItem("");
                vSlist[vSlist.Rows.Count - 1, 0] = RuntimeHelpers.GetObjectValue(ptbl.Rows[num][0]);
                vSlist[vSlist.Rows.Count - 1, 1] = RuntimeHelpers.GetObjectValue(ptbl.Rows[num][1]);
                vSlist[vSlist.Rows.Count - 1, 2] = RuntimeHelpers.GetObjectValue(ptbl.Rows[num][2]);
                vSlist[vSlist.Rows.Count - 1, 3] = 0;
            }
            vSlist = null;
            int num3 = this.VSlist.Cols.Count - 1;
            for (num = 3; num <= num3; num++)
            {
                this.VSlist.Cols[num].Visible = false;
            }
            this.KiemTraDanhMucKho();
        }

        public void LoadDanhMucLoaiKhachHang(DataTable ptbl)
        {
            int num;
            C1.Win.C1FlexGrid.C1FlexGrid vSlist = this.VSlist;
            vSlist.Rows.Count = 1;
            vSlist.Cols[0].Width = 100;
            vSlist.Cols[0].Caption = "M\x00e3 LKH";
            vSlist.Cols[0].TextAlignFixed = TextAlignEnum.CenterCenter;
            vSlist.Cols[1].Width = 300;
            vSlist.Cols[1].Caption = "T\x00ean LKH";
            vSlist.Cols[1].TextAlignFixed = TextAlignEnum.CenterCenter;
            vSlist.Cols[2].Caption = "Diễn giải";
            vSlist.Cols[2].TextAlignFixed = TextAlignEnum.CenterCenter;
            int num2 = ptbl.Rows.Count - 1;
            for (num = 0; num <= num2; num++)
            {
                vSlist.AddItem("");
                vSlist[vSlist.Rows.Count - 1, 0] = RuntimeHelpers.GetObjectValue(ptbl.Rows[num][0]);
                vSlist[vSlist.Rows.Count - 1, 1] = RuntimeHelpers.GetObjectValue(ptbl.Rows[num][1]);
                vSlist[vSlist.Rows.Count - 1, 2] = RuntimeHelpers.GetObjectValue(ptbl.Rows[num][2]);
                vSlist[vSlist.Rows.Count - 1, 3] = 0;
            }
            vSlist = null;
            int num3 = this.VSlist.Cols.Count - 1;
            for (num = 3; num <= num3; num++)
            {
                this.VSlist.Cols[num].Visible = false;
            }
            this.KiemTraDanhMucLoaiKhachHang();
        }

        public void LoadDanhMucNganhHang(DataTable ptbl)
        {
            int num;
            C1.Win.C1FlexGrid.C1FlexGrid vSlist = this.VSlist;
            vSlist.Rows.Count = 1;
            vSlist.Cols[0].Width = 100;
            vSlist.Cols[0].Caption = "M\x00e3 ng\x00e0nh";
            vSlist.Cols[0].TextAlignFixed = TextAlignEnum.CenterCenter;
            vSlist.Cols[1].Width = 300;
            vSlist.Cols[1].Caption = "T\x00ean ng\x00e0nh h\x00e0ng";
            vSlist.Cols[1].TextAlignFixed = TextAlignEnum.CenterCenter;
            vSlist.Cols[2].Caption = "Diễn giải";
            vSlist.Cols[2].TextAlignFixed = TextAlignEnum.CenterCenter;
            int num2 = ptbl.Rows.Count - 1;
            for (num = 0; num <= num2; num++)
            {
                vSlist.AddItem("");
                vSlist[vSlist.Rows.Count - 1, 0] = RuntimeHelpers.GetObjectValue(ptbl.Rows[num][0]);
                vSlist[vSlist.Rows.Count - 1, 1] = RuntimeHelpers.GetObjectValue(ptbl.Rows[num][1]);
                vSlist[vSlist.Rows.Count - 1, 2] = RuntimeHelpers.GetObjectValue(ptbl.Rows[num][2]);
                vSlist[vSlist.Rows.Count - 1, 3] = 0;
            }
            vSlist = null;
            int num3 = this.VSlist.Cols.Count - 1;
            for (num = 3; num <= num3; num++)
            {
                this.VSlist.Cols[num].Visible = false;
            }
            this.KiemTraDanhMucNganhHang();
        }

        public void LoadDanhMucNganhKinhDoanh(DataTable ptbl)
        {
            int num;
            C1.Win.C1FlexGrid.C1FlexGrid vSlist = this.VSlist;
            vSlist.Rows.Count = 1;
            vSlist.Cols[0].Width = 100;
            vSlist.Cols[0].Caption = "M\x00e3 NKD";
            vSlist.Cols[0].TextAlignFixed = TextAlignEnum.CenterCenter;
            vSlist.Cols[1].Width = 300;
            vSlist.Cols[1].Caption = "T\x00ean NKD";
            vSlist.Cols[1].TextAlignFixed = TextAlignEnum.CenterCenter;
            vSlist.Cols[2].Caption = "Diễn giải";
            vSlist.Cols[2].TextAlignFixed = TextAlignEnum.CenterCenter;
            int num2 = ptbl.Rows.Count - 1;
            for (num = 0; num <= num2; num++)
            {
                vSlist.AddItem("");
                vSlist[vSlist.Rows.Count - 1, 0] = RuntimeHelpers.GetObjectValue(ptbl.Rows[num][0]);
                vSlist[vSlist.Rows.Count - 1, 1] = RuntimeHelpers.GetObjectValue(ptbl.Rows[num][1]);
                vSlist[vSlist.Rows.Count - 1, 2] = RuntimeHelpers.GetObjectValue(ptbl.Rows[num][2]);
                vSlist[vSlist.Rows.Count - 1, 3] = 0;
            }
            vSlist = null;
            int num3 = this.VSlist.Cols.Count - 1;
            for (num = 3; num <= num3; num++)
            {
                this.VSlist.Cols[num].Visible = false;
            }
            this.KiemTraDanhMucNganhKinhDoanh();
        }

        public void LoadDanhMucNhaCungCap(DataTable ptbl)
        {
            int num;
            C1.Win.C1FlexGrid.C1FlexGrid vSlist = this.VSlist;
            vSlist.Rows.Count = 1;
            vSlist.Cols[0].Width = 100;
            vSlist.Cols[0].Caption = "M\x00e3 NCC";
            vSlist.Cols[0].TextAlignFixed = TextAlignEnum.CenterCenter;
            vSlist.Cols[1].Width = 250;
            vSlist.Cols[1].Caption = "T\x00ean NCC";
            vSlist.Cols[1].TextAlignFixed = TextAlignEnum.CenterCenter;
            vSlist.Cols[2].Width = 100;
            vSlist.Cols[2].Caption = "M\x00e3 ng\x00e0nh KD";
            vSlist.Cols[2].TextAlignFixed = TextAlignEnum.CenterCenter;
            vSlist.Cols[3].Width = 250;
            vSlist.Cols[3].Caption = "Địa chỉ";
            vSlist.Cols[3].TextAlignFixed = TextAlignEnum.CenterCenter;
            vSlist.Cols[4].Width = 150;
            vSlist.Cols[4].Caption = "Điện thoại";
            vSlist.Cols[4].TextAlignFixed = TextAlignEnum.CenterCenter;
            vSlist.Cols[5].Width = 150;
            vSlist.Cols[5].Caption = "Fax";
            vSlist.Cols[5].TextAlignFixed = TextAlignEnum.CenterCenter;
            vSlist.Cols[6].Width = 150;
            vSlist.Cols[6].Caption = "Email";
            vSlist.Cols[6].TextAlignFixed = TextAlignEnum.CenterCenter;
            vSlist.Cols[7].Width = 150;
            vSlist.Cols[7].Caption = "Website";
            vSlist.Cols[7].TextAlignFixed = TextAlignEnum.CenterCenter;
            vSlist.Cols[8].Width = 150;
            vSlist.Cols[8].Caption = "M\x00e3 số thuế";
            vSlist.Cols[8].TextAlignFixed = TextAlignEnum.CenterCenter;
            vSlist.Cols[9].Width = 100;
            vSlist.Cols[9].Caption = "Vừa l\x00e0 kh\x00e1ch h\x00e0ng";
            vSlist.Cols[9].TextAlignFixed = TextAlignEnum.CenterCenter;
            vSlist.Cols[9].DataType = typeof(bool);
            int num2 = ptbl.Rows.Count - 1;
            for (num = 0; num <= num2; num++)
            {
                vSlist.AddItem("");
                vSlist[vSlist.Rows.Count - 1, 0] = RuntimeHelpers.GetObjectValue(ptbl.Rows[num][0]);
                vSlist[vSlist.Rows.Count - 1, 1] = RuntimeHelpers.GetObjectValue(ptbl.Rows[num][1]);
                vSlist[vSlist.Rows.Count - 1, 2] = RuntimeHelpers.GetObjectValue(ptbl.Rows[num][2]);
                vSlist[vSlist.Rows.Count - 1, 3] = RuntimeHelpers.GetObjectValue(ptbl.Rows[num][3]);
                vSlist[vSlist.Rows.Count - 1, 4] = RuntimeHelpers.GetObjectValue(ptbl.Rows[num][4]);
                vSlist[vSlist.Rows.Count - 1, 5] = RuntimeHelpers.GetObjectValue(ptbl.Rows[num][5]);
                vSlist[vSlist.Rows.Count - 1, 6] = RuntimeHelpers.GetObjectValue(ptbl.Rows[num][6]);
                vSlist[vSlist.Rows.Count - 1, 7] = RuntimeHelpers.GetObjectValue(ptbl.Rows[num][7]);
                vSlist[vSlist.Rows.Count - 1, 8] = RuntimeHelpers.GetObjectValue(ptbl.Rows[num][8]);
                if (Microsoft.VisualBasic.CompilerServices.Operators.ConditionalCompareObjectEqual(LVYModule.ReturnIfNull(RuntimeHelpers.GetObjectValue(ptbl.Rows[num][9]), 0, modGeneral.TypeOfValue.Nothing), 0, false))
                {
                    vSlist[vSlist.Rows.Count - 1, 9] = 0;
                }
                else
                {
                    vSlist[vSlist.Rows.Count - 1, 9] = -1;
                }
                vSlist[vSlist.Rows.Count - 1, 10] = 0;
            }
            vSlist = null;
            int num3 = this.VSlist.Cols.Count - 1;
            for (num = 10; num <= num3; num++)
            {
                this.VSlist.Cols[num].Visible = false;
            }
            this.KiemTraDanhMucNhaCungCap();
        }

        public void LoadDanhMucNhomHangHoa(DataTable ptbl)
        {
            int num;
            C1.Win.C1FlexGrid.C1FlexGrid vSlist = this.VSlist;
            vSlist.Rows.Count = 1;
            vSlist.Cols[0].Width = 100;
            vSlist.Cols[0].Caption = "M\x00e3 nh\x00f3m";
            vSlist.Cols[0].TextAlignFixed = TextAlignEnum.CenterCenter;
            vSlist.Cols[1].Caption = "T\x00ean nh\x00f3m";
            vSlist.Cols[1].TextAlignFixed = TextAlignEnum.CenterCenter;
            vSlist.Cols[2].Width = 100;
            vSlist.Cols[2].Caption = "M\x00e3 ng\x00e0nh h\x00e0ng";
            vSlist.Cols[2].TextAlignFixed = TextAlignEnum.CenterCenter;
            vSlist.Cols[3].Width = 100;
            vSlist.Cols[3].Caption = "T.Khoản h\x00e0ng h\x00f3a";
            vSlist.Cols[3].TextAlignFixed = TextAlignEnum.CenterCenter;
            vSlist.Cols[4].Width = 100;
            vSlist.Cols[4].Caption = "T.Khoản gi\x00e1 vốn";
            vSlist.Cols[4].TextAlignFixed = TextAlignEnum.CenterCenter;
            vSlist.Cols[1].Width = (((this.VSlist.Width - vSlist.Cols[0].Width) - vSlist.Cols[2].Width) - vSlist.Cols[3].Width) - vSlist.Cols[4].Width;
            int num2 = ptbl.Rows.Count - 1;
            for (num = 0; num <= num2; num++)
            {
                vSlist.AddItem("");
                vSlist[vSlist.Rows.Count - 1, 0] = RuntimeHelpers.GetObjectValue(ptbl.Rows[num][0]);
                vSlist[vSlist.Rows.Count - 1, 1] = RuntimeHelpers.GetObjectValue(ptbl.Rows[num][1]);
                vSlist[vSlist.Rows.Count - 1, 2] = RuntimeHelpers.GetObjectValue(ptbl.Rows[num][2]);
                vSlist[vSlist.Rows.Count - 1, 3] = RuntimeHelpers.GetObjectValue(ptbl.Rows[num][3]);
                vSlist[vSlist.Rows.Count - 1, 4] = RuntimeHelpers.GetObjectValue(ptbl.Rows[num][4]);
                vSlist[vSlist.Rows.Count - 1, 5] = 0;
            }
            vSlist = null;
            int num3 = this.VSlist.Cols.Count - 1;
            for (num = 5; num <= num3; num++)
            {
                this.VSlist.Cols[num].Visible = false;
            }
            this.KiemTraDanhMucNhomHangHoa();
        }

        public void LoadDanhMucQuocGia(DataTable ptbl)
        {
            int num;
            C1.Win.C1FlexGrid.C1FlexGrid vSlist = this.VSlist;
            vSlist.Rows.Count = 1;
            vSlist.Cols[0].Width = 100;
            vSlist.Cols[0].Caption = "M\x00e3 QG";
            vSlist.Cols[0].TextAlignFixed = TextAlignEnum.CenterCenter;
            vSlist.Cols[1].Width = 300;
            vSlist.Cols[1].Caption = "T\x00ean QG";
            vSlist.Cols[1].TextAlignFixed = TextAlignEnum.CenterCenter;
            vSlist.Cols[2].Caption = "Diễn giải";
            vSlist.Cols[2].TextAlignFixed = TextAlignEnum.CenterCenter;
            int num2 = ptbl.Rows.Count - 1;
            for (num = 0; num <= num2; num++)
            {
                vSlist.AddItem("");
                vSlist[vSlist.Rows.Count - 1, 0] = RuntimeHelpers.GetObjectValue(ptbl.Rows[num][0]);
                vSlist[vSlist.Rows.Count - 1, 1] = RuntimeHelpers.GetObjectValue(ptbl.Rows[num][1]);
                vSlist[vSlist.Rows.Count - 1, 2] = RuntimeHelpers.GetObjectValue(ptbl.Rows[num][2]);
                vSlist[vSlist.Rows.Count - 1, 3] = 0;
            }
            vSlist = null;
            int num3 = this.VSlist.Cols.Count - 1;
            for (num = 3; num <= num3; num++)
            {
                this.VSlist.Cols[num].Visible = false;
            }
            this.KiemTraDanhMucQuocGia();
        }

        public int SaveDanhMucDonViTinh()
        {
            int num3;
            clsDMDonViTinh tinh = new clsDMDonViTinh();
            int num = 0;
            try
            {
                clsDMDonViTinh tinh2 = tinh;
                int num4 = this.VSlist.Rows.Count - 1;
                for (int i = 1; i <= num4; i++)
                {
                    if (Microsoft.VisualBasic.CompilerServices.Operators.ConditionalCompareObjectEqual(this.VSlist[i, 2], 0, false))
                    {
                        tinh2.Khoa = modGeneral.CreatKey("DM_DonViTinh", 10, "");
                        tinh2.TenViet = Conversions.ToString(LVYModule.ReturnIfNull(this.VSlist[i, 0].ToString(), "", modGeneral.TypeOfValue.Nothing));
                        tinh2.DienGiai = Conversions.ToString(LVYModule.ReturnIfNull(this.VSlist[i, 1].ToString(), "", modGeneral.TypeOfValue.Nothing));
                        tinh2.Active = 1;
                        tinh2.Send = 1;
                        tinh2.KhoaNhanVienCapNhat = modGeneral.H_USERID;
                        tinh2.NgayCapNhat = LVYModule.Date2Char(Strings.Format(DateAndTime.Today, "dd/MM/yyyy"));
                        if (tinh2.Save("I"))
                        {
                            num++;
                        }
                    }
                }
                tinh2 = null;
                this.KiemTraDanhMucDonViTinh();
                num3 = num;
            }
            catch (Exception exception1)
            {
                ProjectData.SetProjectError(exception1);
                Exception exception = exception1;
                MessageBox.Show(exception.Message.ToString());
                num3 = 0;
                ProjectData.ClearProjectError();
                return num3;
                ProjectData.ClearProjectError();
            }
            return num3;
        }

        public int SaveDanhMucHangHoa()
        {
            int num3;
            clsDMHangHoa hoa = new clsDMHangHoa();
            clsDMNganhHang hang = new clsDMNganhHang();
            clsDMNhomHangHoa hoa2 = new clsDMNhomHangHoa();
            clsDMDonViTinh tinh = new clsDMDonViTinh();
            clsDMQuocGia gia = new clsDMQuocGia();
            clsDMHangSanXuat xuat = new clsDMHangSanXuat();
            clsDMTaiKhoan khoan = new clsDMTaiKhoan();
            int num = 0;
            try
            {
                clsDMHangHoa hoa3 = hoa;
                int num4 = this.VSlist.Rows.Count - 1;
                for (int i = 1; i <= num4; i++)
                {
                    if (Microsoft.VisualBasic.CompilerServices.Operators.ConditionalCompareObjectEqual(this.VSlist[i, 20], 0, false))
                    {
                        hoa3.Khoa = modGeneral.CreatKey("DM_HangHoa", 10, "DT");
                        hoa3.Ma = Conversions.ToString(LVYModule.ReturnIfNull(RuntimeHelpers.GetObjectValue(this.VSlist[i, 0]), "", modGeneral.TypeOfValue.Nothing));
                        hoa3.TenViet = Conversions.ToString(LVYModule.ReturnIfNull(RuntimeHelpers.GetObjectValue(this.VSlist[i, 1]), "", modGeneral.TypeOfValue.Nothing));
                        hoa3.KhoaNganh = hang.SearchByCode(Conversions.ToString(LVYModule.ReturnIfNull(this.VSlist[i, 2].ToString().Trim(), "", modGeneral.TypeOfValue.Nothing)), "").Split(new char[] { '|' })[0];
                        hoa3.KhoaNhom = hoa2.SearchByCode(Conversions.ToString(LVYModule.ReturnIfNull(this.VSlist[i, 3].ToString().Trim(), "", modGeneral.TypeOfValue.Nothing)), "", "").Split(new char[] { '|' })[0];
                        hoa3.KhoaDonViTinh = tinh.SearchByCode(Conversions.ToString(LVYModule.ReturnIfNull(this.VSlist[i, 4].ToString().Trim(), "", modGeneral.TypeOfValue.Nothing)), "").Split(new char[] { '|' })[0];
                        hoa3.KhoaQuocGia = gia.SearchByCode(Conversions.ToString(LVYModule.ReturnIfNull(this.VSlist[i, 5].ToString().Trim(), "", modGeneral.TypeOfValue.Nothing)), "").Split(new char[] { '|' })[0];
                        hoa3.KhoaHangSanXuat = xuat.SearchByCode(Conversions.ToString(LVYModule.ReturnIfNull(this.VSlist[i, 6].ToString().Trim(), "", modGeneral.TypeOfValue.Nothing))).Split(new char[] { '|' })[0];
                        hoa3.MaVach = Conversions.ToString(LVYModule.ReturnIfNull(RuntimeHelpers.GetObjectValue(this.VSlist[i, 7]), "", modGeneral.TypeOfValue.Nothing));
                        hoa3.MaHangNhapKhau = Conversions.ToString(LVYModule.ReturnIfNull(RuntimeHelpers.GetObjectValue(this.VSlist[i, 8]), "", modGeneral.TypeOfValue.Nothing));
                        hoa3.MaTheoHang = Conversions.ToString(LVYModule.ReturnIfNull(RuntimeHelpers.GetObjectValue(this.VSlist[i, 9]), "", modGeneral.TypeOfValue.Nothing));
                        hoa3.SoLuongTonToiThieu = Conversions.ToDouble(LVYModule.ReturnIfNull(RuntimeHelpers.GetObjectValue(this.VSlist[i, 10]), 0, modGeneral.TypeOfValue.Nothing));
                        hoa3.ThoiGianBaoHanh = Conversions.ToInteger(LVYModule.ReturnIfNull(RuntimeHelpers.GetObjectValue(this.VSlist[i, 11]), 0, modGeneral.TypeOfValue.Nothing));
                        if (Microsoft.VisualBasic.CompilerServices.Operators.ConditionalCompareObjectNotEqual(LVYModule.ReturnIfNull(this.VSlist[i, 12].ToString().Trim(), "", modGeneral.TypeOfValue.Nothing), "", false))
                        {
                            hoa3.KhoaTKHangHoa = khoan.SearchByCode(this.VSlist[i, 12].ToString().Trim(), "", "", "").Split(new char[] { '|' })[0];
                        }
                        else
                        {
                            hoa2.Load(hoa3.KhoaNhom);
                            hoa3.KhoaTKHangHoa = hoa2.KhoaTKHangHoa;
                        }
                        if (Microsoft.VisualBasic.CompilerServices.Operators.ConditionalCompareObjectNotEqual(LVYModule.ReturnIfNull(this.VSlist[i, 13].ToString().Trim(), "", modGeneral.TypeOfValue.Nothing), "", false))
                        {
                            hoa3.KhoaTKGiaVon = khoan.SearchByCode(this.VSlist[i, 13].ToString().Trim(), "", "", "").Split(new char[] { '|' })[0];
                        }
                        else
                        {
                            hoa2.Load(hoa3.KhoaNhom);
                            hoa3.KhoaTKGiaVon = hoa2.KhoaTKGiaVon;
                        }
                        hoa3.TyLeThue = Conversions.ToInteger(LVYModule.ReturnIfNull(RuntimeHelpers.GetObjectValue(this.VSlist[i, 14]), 0, modGeneral.TypeOfValue.Nothing));
                        hoa3.TyLeThueNhapKhau = Conversions.ToInteger(LVYModule.ReturnIfNull(RuntimeHelpers.GetObjectValue(this.VSlist[i, 15]), 0, modGeneral.TypeOfValue.Nothing));
                        hoa3.ThongSoKythuat = Conversions.ToString(LVYModule.ReturnIfNull(RuntimeHelpers.GetObjectValue(this.VSlist[i, 0x10]), "", modGeneral.TypeOfValue.Nothing));
                        hoa3.TrongLuong = Conversions.ToDouble(LVYModule.ReturnIfNull(RuntimeHelpers.GetObjectValue(this.VSlist[i, 0x11]), 0, modGeneral.TypeOfValue.Nothing));
                        hoa3.KichThuoc = Conversions.ToString(LVYModule.ReturnIfNull(RuntimeHelpers.GetObjectValue(this.VSlist[i, 0x12]), "", modGeneral.TypeOfValue.Nothing));
                        hoa3.TheoDoiBaoHanh = Conversions.ToInteger(LVYModule.ReturnIfNull(RuntimeHelpers.GetObjectValue(this.VSlist[i, 10]), 0, modGeneral.TypeOfValue.Nothing));
                        hoa3.Loai = "HH";
                        hoa3.ThanhPham = 1;
                        hoa3.NguyenLieu = 0;
                        hoa3.ThucDon = 0;
                        hoa3.Active = 1;
                        if (hoa3.Save())
                        {
                            num++;
                        }
                    }
                }
                hoa3 = null;
                this.KiemTraDanhMucHangHoa();
                num3 = num;
            }
            catch (Exception exception1)
            {
                ProjectData.SetProjectError(exception1);
                Exception exception = exception1;
                MessageBox.Show(exception.Message.ToString());
                num3 = 0;
                ProjectData.ClearProjectError();
                return num3;
                ProjectData.ClearProjectError();
            }
            return num3;
        }

        public int SaveDanhMucHangSanXuat()
        {
            int num3;
            clsDMHangSanXuat xuat = new clsDMHangSanXuat();
            int num = 0;
            try
            {
                clsDMHangSanXuat xuat2 = xuat;
                int num4 = this.VSlist.Rows.Count - 1;
                for (int i = 1; i <= num4; i++)
                {
                    if (Microsoft.VisualBasic.CompilerServices.Operators.ConditionalCompareObjectEqual(this.VSlist[i, 3], 0, false))
                    {
                        xuat2.Khoa = modGeneral.CreatKey("DM_HangSanXuat", 10, "");
                        xuat2.Ma = Conversions.ToString(LVYModule.ReturnIfNull(this.VSlist[i, 0].ToString(), "", modGeneral.TypeOfValue.Nothing));
                        xuat2.TenViet = Conversions.ToString(LVYModule.ReturnIfNull(this.VSlist[i, 1].ToString(), "", modGeneral.TypeOfValue.Nothing));
                        xuat2.DienGiai = Conversions.ToString(LVYModule.ReturnIfNull(this.VSlist[i, 2].ToString(), "", modGeneral.TypeOfValue.Nothing));
                        xuat2.Active = 1;
                        xuat2.Send = 1;
                        if (xuat2.Save("I"))
                        {
                            num++;
                        }
                    }
                }
                xuat2 = null;
                this.KiemTraDanhMucHangSanXuat();
                num3 = num;
            }
            catch (Exception exception1)
            {
                ProjectData.SetProjectError(exception1);
                Exception exception = exception1;
                MessageBox.Show(exception.Message.ToString());
                num3 = 0;
                ProjectData.ClearProjectError();
                return num3;
                ProjectData.ClearProjectError();
            }
            return num3;
        }

        public int SaveDanhMucKhachHang()
        {
            int num3;
            clsDMDoiTuong tuong = new clsDMDoiTuong();
            clsDMNganhKinhDoanh doanh = new clsDMNganhKinhDoanh();
            clsDMLoaiKhachHang hang = new clsDMLoaiKhachHang();
            clsDMLoaiGia gia = new clsDMLoaiGia();
            clsDMKhuVuc vuc = new clsDMKhuVuc();
            int num = 0;
            try
            {
                clsDMDoiTuong tuong2 = tuong;
                int num4 = this.VSlist.Rows.Count - 1;
                for (int i = 1; i <= num4; i++)
                {
                    if (Microsoft.VisualBasic.CompilerServices.Operators.ConditionalCompareObjectEqual(this.VSlist[i, 13], 0, false))
                    {
                        tuong2.Khoa = modGeneral.CreatKey("DM_DoiTuong", 10, "DT");
                        tuong2.Ma = Conversions.ToString(LVYModule.ReturnIfNull(RuntimeHelpers.GetObjectValue(this.VSlist[i, 0]), "", modGeneral.TypeOfValue.Nothing));
                        tuong2.TenViet = Conversions.ToString(LVYModule.ReturnIfNull(RuntimeHelpers.GetObjectValue(this.VSlist[i, 1]), "", modGeneral.TypeOfValue.Nothing));
                        tuong2.KhoaNganh = doanh.SearchByCode(Conversions.ToString(LVYModule.ReturnIfNull(this.VSlist[i, 2].ToString().Trim(), "", modGeneral.TypeOfValue.Nothing)), "").Split(new char[] { '|' })[0];
                        tuong2.KhoaLoaiKhachHang = hang.SearchByCode(Conversions.ToString(LVYModule.ReturnIfNull(this.VSlist[i, 3].ToString().Trim(), "", modGeneral.TypeOfValue.Nothing)), "", "").Split(new char[] { '|' })[0];
                        tuong2.KhoaLoaiGia = gia.SearchByCode(Conversions.ToString(LVYModule.ReturnIfNull(this.VSlist[i, 4].ToString().Trim(), "", modGeneral.TypeOfValue.Nothing)), "", "").Split(new char[] { '|' })[0];
                        tuong2.KhoaKhuVuc = vuc.SearchByCode(Conversions.ToString(LVYModule.ReturnIfNull(this.VSlist[i, 5].ToString().Trim(), "", modGeneral.TypeOfValue.Nothing)), "", "").Split(new char[] { '|' })[0];
                        tuong2.DiaChi = Conversions.ToString(LVYModule.ReturnIfNull(RuntimeHelpers.GetObjectValue(this.VSlist[i, 6]), "", modGeneral.TypeOfValue.Nothing));
                        tuong2.DienThoai = Conversions.ToString(LVYModule.ReturnIfNull(RuntimeHelpers.GetObjectValue(this.VSlist[i, 7]), "", modGeneral.TypeOfValue.Nothing));
                        tuong2.Fax = Conversions.ToString(LVYModule.ReturnIfNull(RuntimeHelpers.GetObjectValue(this.VSlist[i, 8]), "", modGeneral.TypeOfValue.Nothing));
                        tuong2.Email = Conversions.ToString(LVYModule.ReturnIfNull(RuntimeHelpers.GetObjectValue(this.VSlist[i, 9]), "", modGeneral.TypeOfValue.Nothing));
                        tuong2.Website = Conversions.ToString(LVYModule.ReturnIfNull(RuntimeHelpers.GetObjectValue(this.VSlist[i, 10]), "", modGeneral.TypeOfValue.Nothing));
                        tuong2.MaSoThue = Conversions.ToString(LVYModule.ReturnIfNull(RuntimeHelpers.GetObjectValue(this.VSlist[i, 11]), "", modGeneral.TypeOfValue.Nothing));
                        if (Conversion.Val(RuntimeHelpers.GetObjectValue(this.VSlist[i, 12])) != 0.0)
                        {
                            tuong2.Loai = "CS";
                        }
                        else
                        {
                            tuong2.Loai = "C";
                        }
                        tuong2.Active = 1;
                        if (tuong2.Save(""))
                        {
                            num++;
                        }
                    }
                }
                tuong2 = null;
                this.KiemTraDanhMucKhachHang();
                num3 = num;
            }
            catch (Exception exception1)
            {
                ProjectData.SetProjectError(exception1);
                Exception exception = exception1;
                MessageBox.Show(exception.Message.ToString());
                num3 = 0;
                ProjectData.ClearProjectError();
                return num3;
                ProjectData.ClearProjectError();
            }
            return num3;
        }

        public int SaveDanhMucKho()
        {
            int num3;
            clsDMKho kho = new clsDMKho();
            int num = 0;
            try
            {
                clsDMKho kho2 = kho;
                int num4 = this.VSlist.Rows.Count - 1;
                for (int i = 1; i <= num4; i++)
                {
                    if (Microsoft.VisualBasic.CompilerServices.Operators.ConditionalCompareObjectEqual(this.VSlist[i, 3], 0, false))
                    {
                        kho2.Khoa = modGeneral.CreatKey("DM_Kho", 10, "");
                        kho2.Ma = Conversions.ToString(LVYModule.ReturnIfNull(this.VSlist[i, 0].ToString(), "", modGeneral.TypeOfValue.Nothing));
                        kho2.TenViet = Conversions.ToString(LVYModule.ReturnIfNull(this.VSlist[i, 1].ToString(), "", modGeneral.TypeOfValue.Nothing));
                        kho2.DienGiai = Conversions.ToString(LVYModule.ReturnIfNull(this.VSlist[i, 2].ToString(), "", modGeneral.TypeOfValue.Nothing));
                        kho2.Active = 1;
                        kho2.Send = 1;
                        if (kho2.Save("I"))
                        {
                            num++;
                        }
                    }
                }
                kho2 = null;
                this.KiemTraDanhMucKho();
                num3 = num;
            }
            catch (Exception exception1)
            {
                ProjectData.SetProjectError(exception1);
                Exception exception = exception1;
                MessageBox.Show(exception.Message.ToString());
                num3 = 0;
                ProjectData.ClearProjectError();
                return num3;
                ProjectData.ClearProjectError();
            }
            return num3;
        }

        public int SaveDanhMucLoaiKhachHang()
        {
            int num3;
            clsDMLoaiKhachHang hang = new clsDMLoaiKhachHang();
            int num = 0;
            try
            {
                clsDMLoaiKhachHang hang2 = hang;
                int num4 = this.VSlist.Rows.Count - 1;
                for (int i = 1; i <= num4; i++)
                {
                    if (Microsoft.VisualBasic.CompilerServices.Operators.ConditionalCompareObjectEqual(this.VSlist[i, 3], 0, false))
                    {
                        hang2.Khoa = modGeneral.CreatKey("DM_LoaiKhachHang", 10, "");
                        hang2.Ma = Conversions.ToString(LVYModule.ReturnIfNull(this.VSlist[i, 0].ToString(), "", modGeneral.TypeOfValue.Nothing));
                        hang2.TenViet = Conversions.ToString(LVYModule.ReturnIfNull(this.VSlist[i, 1].ToString(), "", modGeneral.TypeOfValue.Nothing));
                        hang2.DienGiai = Conversions.ToString(LVYModule.ReturnIfNull(this.VSlist[i, 2].ToString(), "", modGeneral.TypeOfValue.Nothing));
                        hang2.Active = 1;
                        hang2.Send = 0;
                        if (hang2.Save("I"))
                        {
                            num++;
                        }
                    }
                }
                hang2 = null;
                this.KiemTraDanhMucLoaiKhachHang();
                num3 = num;
            }
            catch (Exception exception1)
            {
                ProjectData.SetProjectError(exception1);
                Exception exception = exception1;
                MessageBox.Show(exception.Message.ToString());
                num3 = 0;
                ProjectData.ClearProjectError();
                return num3;
                ProjectData.ClearProjectError();
            }
            return num3;
        }

        public int SaveDanhMucNganhHang()
        {
            int num3;
            clsDMNganhHang hang = new clsDMNganhHang();
            int num = 0;
            try
            {
                clsDMNganhHang hang2 = hang;
                int num4 = this.VSlist.Rows.Count - 1;
                for (int i = 1; i <= num4; i++)
                {
                    if (Microsoft.VisualBasic.CompilerServices.Operators.ConditionalCompareObjectEqual(this.VSlist[i, 3], 0, false))
                    {
                        hang2.Khoa = modGeneral.CreatKey("DM_NganhHang", 10, "");
                        hang2.Ma = Conversions.ToString(LVYModule.ReturnIfNull(this.VSlist[i, 0].ToString(), "", modGeneral.TypeOfValue.Nothing));
                        hang2.TenViet = Conversions.ToString(LVYModule.ReturnIfNull(this.VSlist[i, 1].ToString(), "", modGeneral.TypeOfValue.Nothing));
                        hang2.DienGiai = Conversions.ToString(LVYModule.ReturnIfNull(this.VSlist[i, 2].ToString(), "", modGeneral.TypeOfValue.Nothing));
                        hang2.Active = 1;
                        hang2.Send = 0;
                        if (hang2.Save("I"))
                        {
                            num++;
                        }
                    }
                }
                hang2 = null;
                this.KiemTraDanhMucNganhHang();
                num3 = num;
            }
            catch (Exception exception1)
            {
                ProjectData.SetProjectError(exception1);
                Exception exception = exception1;
                MessageBox.Show(exception.Message.ToString());
                num3 = 0;
                ProjectData.ClearProjectError();
                return num3;
                ProjectData.ClearProjectError();
            }
            return num3;
        }

        public int SaveDanhMucNganhKinhDoanh()
        {
            int num3;
            clsDMNganhKinhDoanh doanh = new clsDMNganhKinhDoanh();
            int num = 0;
            try
            {
                clsDMNganhKinhDoanh doanh2 = doanh;
                int num4 = this.VSlist.Rows.Count - 1;
                for (int i = 1; i <= num4; i++)
                {
                    if (Microsoft.VisualBasic.CompilerServices.Operators.ConditionalCompareObjectEqual(this.VSlist[i, 3], 0, false))
                    {
                        doanh2.Khoa = modGeneral.CreatKey("DM_NganhKinhDoanh", 10, "");
                        doanh2.Ma = Conversions.ToString(LVYModule.ReturnIfNull(this.VSlist[i, 0].ToString(), "", modGeneral.TypeOfValue.Nothing));
                        doanh2.TenViet = Conversions.ToString(LVYModule.ReturnIfNull(this.VSlist[i, 1].ToString(), "", modGeneral.TypeOfValue.Nothing));
                        doanh2.DienGiai = Conversions.ToString(LVYModule.ReturnIfNull(this.VSlist[i, 2].ToString(), "", modGeneral.TypeOfValue.Nothing));
                        doanh2.Active = 1;
                        doanh2.Send = 0;
                        if (doanh2.Save("I"))
                        {
                            num++;
                        }
                    }
                }
                doanh2 = null;
                this.KiemTraDanhMucNganhKinhDoanh();
                num3 = num;
            }
            catch (Exception exception1)
            {
                ProjectData.SetProjectError(exception1);
                Exception exception = exception1;
                MessageBox.Show(exception.Message.ToString());
                num3 = 0;
                ProjectData.ClearProjectError();
                return num3;
                ProjectData.ClearProjectError();
            }
            return num3;
        }

        public int SaveDanhMucNhaCungCap()
        {
            int num3;
            clsDMDoiTuong tuong = new clsDMDoiTuong();
            clsDMNganhKinhDoanh doanh = new clsDMNganhKinhDoanh();
            int num = 0;
            try
            {
                clsDMDoiTuong tuong2 = tuong;
                int num4 = this.VSlist.Rows.Count - 1;
                for (int i = 1; i <= num4; i++)
                {
                    if (Microsoft.VisualBasic.CompilerServices.Operators.ConditionalCompareObjectEqual(this.VSlist[i, 10], 0, false))
                    {
                        tuong2.Khoa = modGeneral.CreatKey("DM_DoiTuong", 10, "DT");
                        tuong2.Ma = Conversions.ToString(LVYModule.ReturnIfNull(RuntimeHelpers.GetObjectValue(this.VSlist[i, 0]), "", modGeneral.TypeOfValue.Nothing));
                        tuong2.TenViet = Conversions.ToString(LVYModule.ReturnIfNull(RuntimeHelpers.GetObjectValue(this.VSlist[i, 1]), "", modGeneral.TypeOfValue.Nothing));
                        tuong2.KhoaNganh = doanh.SearchByCode(Conversions.ToString(LVYModule.ReturnIfNull(this.VSlist[i, 2].ToString().Trim(), "", modGeneral.TypeOfValue.Nothing)), "").Split(new char[] { '|' })[0];
                        tuong2.DiaChi = Conversions.ToString(LVYModule.ReturnIfNull(RuntimeHelpers.GetObjectValue(this.VSlist[i, 3]), "", modGeneral.TypeOfValue.Nothing));
                        tuong2.DienThoai = Conversions.ToString(LVYModule.ReturnIfNull(RuntimeHelpers.GetObjectValue(this.VSlist[i, 4]), "", modGeneral.TypeOfValue.Nothing));
                        tuong2.Fax = Conversions.ToString(LVYModule.ReturnIfNull(RuntimeHelpers.GetObjectValue(this.VSlist[i, 5]), "", modGeneral.TypeOfValue.Nothing));
                        tuong2.Email = Conversions.ToString(LVYModule.ReturnIfNull(RuntimeHelpers.GetObjectValue(this.VSlist[i, 6]), "", modGeneral.TypeOfValue.Nothing));
                        tuong2.Website = Conversions.ToString(LVYModule.ReturnIfNull(RuntimeHelpers.GetObjectValue(this.VSlist[i, 7]), "", modGeneral.TypeOfValue.Nothing));
                        tuong2.MaSoThue = Conversions.ToString(LVYModule.ReturnIfNull(RuntimeHelpers.GetObjectValue(this.VSlist[i, 8]), "", modGeneral.TypeOfValue.Nothing));
                        if (Conversion.Val(RuntimeHelpers.GetObjectValue(this.VSlist[i, 9])) != 0.0)
                        {
                            tuong2.Loai = "SC";
                        }
                        else
                        {
                            tuong2.Loai = "S";
                        }
                        tuong2.Active = 1;
                        if (tuong2.Save(""))
                        {
                            num++;
                        }
                    }
                }
                tuong2 = null;
                this.KiemTraDanhMucNhaCungCap();
                num3 = num;
            }
            catch (Exception exception1)
            {
                ProjectData.SetProjectError(exception1);
                Exception exception = exception1;
                MessageBox.Show(exception.Message.ToString());
                num3 = 0;
                ProjectData.ClearProjectError();
                return num3;
                ProjectData.ClearProjectError();
            }
            return num3;
        }

        public int SaveDanhMucNhomHangHoa()
        {
            int num3;
            clsDMNhomHangHoa hoa = new clsDMNhomHangHoa();
            clsDMNganhHang hang = new clsDMNganhHang();
            clsDMTaiKhoan khoan = new clsDMTaiKhoan();
            int num = 0;
            try
            {
                clsDMNhomHangHoa hoa2 = hoa;
                int num4 = this.VSlist.Rows.Count - 1;
                for (int i = 1; i <= num4; i++)
                {
                    if (Microsoft.VisualBasic.CompilerServices.Operators.ConditionalCompareObjectEqual(this.VSlist[i, 5], 0, false))
                    {
                        hoa2.Khoa = modGeneral.CreatKey("DM_NhomHangHoa", 10, "");
                        hoa2.KhoaNganh = hang.SearchByCode(Conversions.ToString(LVYModule.ReturnIfNull(this.VSlist[i, 2].ToString().Trim(), "", modGeneral.TypeOfValue.Nothing)), "").Split(new char[] { '|' })[0];
                        hoa2.Ma = Conversions.ToString(LVYModule.ReturnIfNull(RuntimeHelpers.GetObjectValue(this.VSlist[i, 0]), "", modGeneral.TypeOfValue.Nothing));
                        hoa2.TenViet = Conversions.ToString(LVYModule.ReturnIfNull(RuntimeHelpers.GetObjectValue(this.VSlist[i, 1]), "", modGeneral.TypeOfValue.Nothing));
                        hoa2.KhoaTKHangHoa = khoan.SearchByCode(Conversions.ToString(LVYModule.ReturnIfNull(this.VSlist[i, 3].ToString().Trim(), "", modGeneral.TypeOfValue.Nothing)), "", "", "").Split(new char[] { '|' })[0];
                        hoa2.KhoaTKGiaVon = khoan.SearchByCode(Conversions.ToString(LVYModule.ReturnIfNull(this.VSlist[i, 4].ToString().Trim(), "", modGeneral.TypeOfValue.Nothing)), "", "", "").Split(new char[] { '|' })[0];
                        hoa2.NguyenLieu = 1;
                        hoa2.Active = 1;
                        if (hoa2.Save())
                        {
                            num++;
                        }
                    }
                }
                hoa2 = null;
                this.KiemTraDanhMucNhomHangHoa();
                num3 = num;
            }
            catch (Exception exception1)
            {
                ProjectData.SetProjectError(exception1);
                Exception exception = exception1;
                MessageBox.Show(exception.Message.ToString());
                num3 = 0;
                ProjectData.ClearProjectError();
                return num3;
                ProjectData.ClearProjectError();
            }
            return num3;
        }

        public int SaveDanhMucQuocGia()
        {
            int num3;
            clsDMQuocGia gia = new clsDMQuocGia();
            int num = 0;
            try
            {
                clsDMQuocGia gia2 = gia;
                int num4 = this.VSlist.Rows.Count - 1;
                for (int i = 1; i <= num4; i++)
                {
                    if (Microsoft.VisualBasic.CompilerServices.Operators.ConditionalCompareObjectEqual(this.VSlist[i, 3], 0, false))
                    {
                        gia2.Khoa = modGeneral.CreatKey("DM_QuocGia", 10, "");
                        gia2.Ma = Conversions.ToString(LVYModule.ReturnIfNull(this.VSlist[i, 0].ToString(), "", modGeneral.TypeOfValue.Nothing));
                        gia2.TenViet = Conversions.ToString(LVYModule.ReturnIfNull(this.VSlist[i, 1].ToString(), "", modGeneral.TypeOfValue.Nothing));
                        gia2.DienGiai = Conversions.ToString(LVYModule.ReturnIfNull(this.VSlist[i, 2].ToString(), "", modGeneral.TypeOfValue.Nothing));
                        gia2.Active = 1;
                        gia2.Send = 0;
                        if (gia2.Save("I"))
                        {
                            num++;
                        }
                    }
                }
                gia2 = null;
                this.KiemTraDanhMucQuocGia();
                num3 = num;
            }
            catch (Exception exception1)
            {
                ProjectData.SetProjectError(exception1);
                Exception exception = exception1;
                MessageBox.Show(exception.Message.ToString());
                num3 = 0;
                ProjectData.ClearProjectError();
                return num3;
                ProjectData.ClearProjectError();
            }
            return num3;
        }

        internal virtual Button cmdNhap
        {
            [DebuggerNonUserCode]
            get
            {
                return this._cmdNhap;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                EventHandler handler = new EventHandler(this.cmdNhap_Click);
                if (this._cmdNhap != null)
                {
                    this._cmdNhap.Click -= handler;
                }
                this._cmdNhap = value;
                if (this._cmdNhap != null)
                {
                    this._cmdNhap.Click += handler;
                }
            }
        }

        internal virtual Button CmdThoat
        {
            [DebuggerNonUserCode]
            get
            {
                return this._CmdThoat;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                EventHandler handler = new EventHandler(this.CmdThoat_Click);
                if (this._CmdThoat != null)
                {
                    this._CmdThoat.Click -= handler;
                }
                this._CmdThoat = value;
                if (this._CmdThoat != null)
                {
                    this._CmdThoat.Click += handler;
                }
            }
        }

        internal virtual Label Label1
        {
            [DebuggerNonUserCode]
            get
            {
                return this._Label1;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._Label1 = value;
            }
        }

        internal virtual Label Label2
        {
            [DebuggerNonUserCode]
            get
            {
                return this._Label2;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._Label2 = value;
            }
        }

        internal virtual Label lblTitle
        {
            [DebuggerNonUserCode]
            get
            {
                return this._lblTitle;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._lblTitle = value;
            }
        }

        internal virtual Panel Panel1
        {
            [DebuggerNonUserCode]
            get
            {
                return this._Panel1;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._Panel1 = value;
            }
        }

        internal virtual Panel Panel2
        {
            [DebuggerNonUserCode]
            get
            {
                return this._Panel2;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._Panel2 = value;
            }
        }

        internal virtual Panel Panel3
        {
            [DebuggerNonUserCode]
            get
            {
                return this._Panel3;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._Panel3 = value;
            }
        }

        internal virtual Panel Panel4
        {
            [DebuggerNonUserCode]
            get
            {
                return this._Panel4;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._Panel4 = value;
            }
        }

        internal virtual Panel Panel5
        {
            [DebuggerNonUserCode]
            get
            {
                return this._Panel5;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._Panel5 = value;
            }
        }

        internal virtual Panel Panel6
        {
            [DebuggerNonUserCode]
            get
            {
                return this._Panel6;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._Panel6 = value;
            }
        }

        internal virtual Panel Panel7
        {
            [DebuggerNonUserCode]
            get
            {
                return this._Panel7;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._Panel7 = value;
            }
        }

        internal virtual C1.Win.C1FlexGrid.C1FlexGrid VSlist
        {
            [DebuggerNonUserCode]
            get
            {
                return this._VSlist;
            }
            [MethodImpl(MethodImplOptions.Synchronized), DebuggerNonUserCode]
            set
            {
                this._VSlist = value;
            }
        }
    }
}

